diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 65f558e7..4191c889 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0" + ".": "3.0.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ff9c78f6..efcf5ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 3.0.0 (2025-01-06) + +Full Changelog: [v2.0.0...v3.0.0](https://github.com/Finch-API/finch-api-java/compare/v2.0.0...v3.0.0) + +### ⚠ BREAKING CHANGES + +* **client:** switch query params objects to use `QueryParams` ([#369](https://github.com/Finch-API/finch-api-java/issues/369)) + +### Features + +* **client:** allow passing null or optional for nullable fields ([#379](https://github.com/Finch-API/finch-api-java/issues/379)) ([e4f8ca9](https://github.com/Finch-API/finch-api-java/commit/e4f8ca9dd0387833aa49d7a386bf806cf2af597b)) + + +### Chores + +* **internal:** codegen related update ([#374](https://github.com/Finch-API/finch-api-java/issues/374)) ([720b466](https://github.com/Finch-API/finch-api-java/commit/720b4664e700de2ddc5438a6ef3b0b9a4e882b32)) +* **internal:** codegen related update ([#376](https://github.com/Finch-API/finch-api-java/issues/376)) ([e61b257](https://github.com/Finch-API/finch-api-java/commit/e61b257b31e6824ceabe52c3d01e97a76ea7d0b2)) + + +### Styles + +* **internal:** sort fields ([#377](https://github.com/Finch-API/finch-api-java/issues/377)) ([0d8e0c9](https://github.com/Finch-API/finch-api-java/commit/0d8e0c980e77ceb4870ae930a22bc893249596b2)) + + +### Refactors + +* **client:** switch query params objects to use `QueryParams` ([#369](https://github.com/Finch-API/finch-api-java/issues/369)) ([af3c693](https://github.com/Finch-API/finch-api-java/commit/af3c693140281966f4162675c137b93bdcbf0014)) +* **internal:** use constructor to deserialize json ([#371](https://github.com/Finch-API/finch-api-java/issues/371)) ([418c911](https://github.com/Finch-API/finch-api-java/commit/418c911946742d49875c927b53dd86ddd750d59a)) + ## 2.0.0 (2024-12-19) Full Changelog: [v1.12.0...v2.0.0](https://github.com/Finch-API/finch-api-java/compare/v1.12.0...v2.0.0) diff --git a/LICENSE b/LICENSE index 1dac0f68..eee60015 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Finch + Copyright 2025 Finch Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index cb2abde7..dcd740fe 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/2.0.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/3.0.0) @@ -27,7 +27,7 @@ The REST API documentation can be found [in the Finch Documentation Center](htt ```kotlin -implementation("com.tryfinch.api:finch-java:2.0.0") +implementation("com.tryfinch.api:finch-java:3.0.0") ``` #### Maven @@ -36,7 +36,7 @@ implementation("com.tryfinch.api:finch-java:2.0.0") com.tryfinch.api finch-java - 2.0.0 + 3.0.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index b4f521ea..29cf7048 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.tryfinch.api" - version = "2.0.0" // x-release-please-version + version = "3.0.0" // x-release-please-version } diff --git a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt index 6796f03a..786e65de 100644 --- a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt +++ b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClient.kt @@ -11,6 +11,7 @@ import com.tryfinch.api.core.http.QueryParams import java.net.Proxy import java.time.Clock import java.time.Duration +import java.util.Optional class FinchOkHttpClient private constructor() { @@ -130,14 +131,23 @@ class FinchOkHttpClient private constructor() { fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) } + fun accessToken(accessToken: Optional) = accessToken(accessToken.orElse(null)) + fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) } + fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) + fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) } + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + fun webhookSecret(webhookSecret: String?) = apply { clientOptions.webhookSecret(webhookSecret) } + fun webhookSecret(webhookSecret: Optional) = + webhookSecret(webhookSecret.orElse(null)) + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): FinchClient = diff --git a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt index 469c64c2..9ce013bb 100644 --- a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt +++ b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/FinchOkHttpClientAsync.kt @@ -11,6 +11,7 @@ import com.tryfinch.api.core.http.QueryParams import java.net.Proxy import java.time.Clock import java.time.Duration +import java.util.Optional class FinchOkHttpClientAsync private constructor() { @@ -130,14 +131,23 @@ class FinchOkHttpClientAsync private constructor() { fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) } + fun accessToken(accessToken: Optional) = accessToken(accessToken.orElse(null)) + fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) } + fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) + fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) } + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + fun webhookSecret(webhookSecret: String?) = apply { clientOptions.webhookSecret(webhookSecret) } + fun webhookSecret(webhookSecret: Optional) = + webhookSecret(webhookSecret.orElse(null)) + fun fromEnv() = apply { clientOptions.fromEnv() } fun build(): FinchClientAsync = 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 ecf0193b..0bfac953 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 @@ -170,9 +170,9 @@ constructor( .clock(clientOptions.clock) .baseUrl(clientOptions.baseUrl) .accessToken(accessToken) - .clientId(clientOptions.clientId) - .clientSecret(clientOptions.clientSecret) - .webhookSecret(clientOptions.webhookSecret) + .apply { clientOptions.clientId?.let(::clientId) } + .apply { clientOptions.clientSecret?.let(::clientSecret) } + .apply { clientOptions.webhookSecret?.let(::webhookSecret) } .headers(clientOptions.headers) .responseValidation(clientOptions.responseValidation) .build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt index bb24b79b..e8cbf482 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 @@ -159,9 +159,9 @@ constructor( .clock(clientOptions.clock) .baseUrl(clientOptions.baseUrl) .accessToken(accessToken) - .clientId(clientOptions.clientId) - .clientSecret(clientOptions.clientSecret) - .webhookSecret(clientOptions.webhookSecret) + .apply { clientOptions.clientId?.let(::clientId) } + .apply { clientOptions.clientSecret?.let(::clientSecret) } + .apply { clientOptions.webhookSecret?.let(::webhookSecret) } .headers(clientOptions.headers) .responseValidation(clientOptions.responseValidation) .build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt index 99539e08..743402d6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/ClientOptions.kt @@ -10,6 +10,7 @@ import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.http.RetryingHttpClient import java.time.Clock import java.util.Base64 +import java.util.Optional class ClientOptions private constructor( @@ -166,12 +167,21 @@ private constructor( fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken } + fun accessToken(accessToken: Optional) = accessToken(accessToken.orElse(null)) + fun clientId(clientId: String?) = apply { this.clientId = clientId } + fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) + fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret } + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret } + fun webhookSecret(webhookSecret: Optional) = + webhookSecret(webhookSecret.orElse(null)) + fun fromEnv() = apply { System.getenv("FINCH_CLIENT_ID")?.let { clientId(it) } System.getenv("FINCH_CLIENT_SECRET")?.let { clientSecret(it) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt index 602e77c6..c2f32509 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt @@ -17,7 +17,9 @@ internal fun List.toImmutable(): List = @JvmSynthetic internal fun Map.toImmutable(): Map = - if (isEmpty()) Collections.emptyMap() else Collections.unmodifiableMap(toMap()) + if (isEmpty()) immutableEmptyMap() else Collections.unmodifiableMap(toMap()) + +@JvmSynthetic internal fun immutableEmptyMap(): Map = Collections.emptyMap() @JvmSynthetic internal fun , V> SortedMap.toImmutable(): SortedMap = diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt index 14aabb06..da8d7b2e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt @@ -4,19 +4,23 @@ package com.tryfinch.api.errors import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.annotation.JsonCreator +import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = FinchError.Builder::class) @NoAutoDetect class FinchError +@JsonCreator private constructor( @JsonAnyGetter + @ExcludeMissing + @JsonAnySetter @get:JvmName("additionalProperties") - val additionalProperties: Map, + val additionalProperties: Map = immutableEmptyMap(), ) { fun toBuilder() = Builder().from(this) @@ -40,7 +44,6 @@ private constructor( putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt index 876f7a57..52895682 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccessTokenCreateParams.kt @@ -4,75 +4,66 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional class AccessTokenCreateParams constructor( - private val code: String, - private val clientId: String?, - private val clientSecret: String?, - private val redirectUri: String?, + private val body: AccessTokenCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun code(): String = code + fun code(): String = body.code() - fun clientId(): Optional = Optional.ofNullable(clientId) + fun clientId(): Optional = body.clientId() - fun clientSecret(): Optional = Optional.ofNullable(clientSecret) + fun clientSecret(): Optional = body.clientSecret() - fun redirectUri(): Optional = Optional.ofNullable(redirectUri) + fun redirectUri(): Optional = body.redirectUri() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): AccessTokenCreateBody { - return AccessTokenCreateBody( - code, - clientId, - clientSecret, - redirectUri, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): AccessTokenCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = AccessTokenCreateBody.Builder::class) @NoAutoDetect class AccessTokenCreateBody + @JsonCreator internal constructor( - private val code: String?, - private val clientId: String?, - private val clientSecret: String?, - private val redirectUri: String?, - private val additionalProperties: Map, + @JsonProperty("code") private val code: String, + @JsonProperty("client_id") private val clientId: String?, + @JsonProperty("client_secret") private val clientSecret: String?, + @JsonProperty("redirect_uri") private val redirectUri: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("code") fun code(): String? = code + @JsonProperty("code") fun code(): String = code - @JsonProperty("client_id") fun clientId(): String? = clientId + @JsonProperty("client_id") fun clientId(): Optional = Optional.ofNullable(clientId) - @JsonProperty("client_secret") fun clientSecret(): String? = clientSecret + @JsonProperty("client_secret") + fun clientSecret(): Optional = Optional.ofNullable(clientSecret) - @JsonProperty("redirect_uri") fun redirectUri(): String? = redirectUri + @JsonProperty("redirect_uri") + fun redirectUri(): Optional = Optional.ofNullable(redirectUri) @JsonAnyGetter @ExcludeMissing @@ -95,38 +86,47 @@ constructor( @JvmSynthetic internal fun from(accessTokenCreateBody: AccessTokenCreateBody) = apply { - this.code = accessTokenCreateBody.code - this.clientId = accessTokenCreateBody.clientId - this.clientSecret = accessTokenCreateBody.clientSecret - this.redirectUri = accessTokenCreateBody.redirectUri - additionalProperties(accessTokenCreateBody.additionalProperties) + code = accessTokenCreateBody.code + clientId = accessTokenCreateBody.clientId + clientSecret = accessTokenCreateBody.clientSecret + redirectUri = accessTokenCreateBody.redirectUri + additionalProperties = accessTokenCreateBody.additionalProperties.toMutableMap() } - @JsonProperty("code") fun code(code: String) = apply { this.code = code } + fun code(code: String) = apply { this.code = code } + + fun clientId(clientId: String?) = apply { this.clientId = clientId } + + fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) - @JsonProperty("client_id") - fun clientId(clientId: String) = apply { this.clientId = clientId } + fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret } - @JsonProperty("client_secret") - fun clientSecret(clientSecret: String) = apply { this.clientSecret = clientSecret } + fun clientSecret(clientSecret: Optional) = + clientSecret(clientSecret.orElse(null)) - @JsonProperty("redirect_uri") - fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + fun redirectUri(redirectUri: String?) = apply { this.redirectUri = redirectUri } + + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AccessTokenCreateBody = AccessTokenCreateBody( checkNotNull(code) { "`code` is required but was not set" }, @@ -165,33 +165,30 @@ constructor( @NoAutoDetect class Builder { - private var code: String? = null - private var clientId: String? = null - private var clientSecret: String? = null - private var redirectUri: String? = null + private var body: AccessTokenCreateBody.Builder = AccessTokenCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accessTokenCreateParams: AccessTokenCreateParams) = apply { - code = accessTokenCreateParams.code - clientId = accessTokenCreateParams.clientId - clientSecret = accessTokenCreateParams.clientSecret - redirectUri = accessTokenCreateParams.redirectUri + body = accessTokenCreateParams.body.toBuilder() additionalHeaders = accessTokenCreateParams.additionalHeaders.toBuilder() additionalQueryParams = accessTokenCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - accessTokenCreateParams.additionalBodyProperties.toMutableMap() } - fun code(code: String) = apply { this.code = code } + fun code(code: String) = apply { body.code(code) } + + fun clientId(clientId: String?) = apply { body.clientId(clientId) } - fun clientId(clientId: String) = apply { this.clientId = clientId } + fun clientId(clientId: Optional) = clientId(clientId.orElse(null)) - fun clientSecret(clientSecret: String) = apply { this.clientSecret = clientSecret } + fun clientSecret(clientSecret: String?) = apply { body.clientSecret(clientSecret) } - fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.orElse(null)) + + fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } + + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -292,36 +289,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): AccessTokenCreateParams = AccessTokenCreateParams( - checkNotNull(code) { "`code` is required but was not set" }, - clientId, - clientSecret, - redirectUri, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -330,11 +320,11 @@ constructor( return true } - return /* spotless:off */ other is AccessTokenCreateParams && code == other.code && clientId == other.clientId && clientSecret == other.clientSecret && redirectUri == other.redirectUri && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is AccessTokenCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(code, clientId, clientSecret, redirectUri, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "AccessTokenCreateParams{code=$code, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "AccessTokenCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index 0b5b001e..328ed3c2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -6,41 +6,46 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects -@JsonDeserialize(builder = AccountCreateResponse.Builder::class) @NoAutoDetect class AccountCreateResponse +@JsonCreator private constructor( - private val connectionId: JsonField, - 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, + @JsonProperty("access_token") + @ExcludeMissing + private val accessToken: JsonField = JsonMissing.of(), + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + private val authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + private val providerId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The ID of the new connection */ - fun connectionId(): String = connectionId.getRequired("connection_id") - - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - fun companyId(): String = companyId.getRequired("company_id") - - /** The ID of the provider associated with the `access_token` */ - fun providerId(): String = providerId.getRequired("provider_id") + fun accessToken(): String = accessToken.getRequired("access_token") /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun accountId(): String = accountId.getRequired("account_id") @@ -48,18 +53,18 @@ private constructor( fun authenticationType(): AuthenticationType = authenticationType.getRequired("authentication_type") - fun products(): List = products.getRequired("products") - - fun accessToken(): String = accessToken.getRequired("access_token") + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + fun companyId(): String = companyId.getRequired("company_id") /** The ID of the new connection */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun connectionId(): String = connectionId.getRequired("connection_id") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + fun products(): List = products.getRequired("products") /** The ID of the provider associated with the `access_token` */ - @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId + fun providerId(): String = providerId.getRequired("provider_id") + + @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId @@ -68,23 +73,32 @@ private constructor( @ExcludeMissing fun _authenticationType() = authenticationType + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + + /** The ID of the new connection */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + @JsonProperty("products") @ExcludeMissing fun _products() = products - @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken + /** The ID of the provider associated with the `access_token` */ + @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AccountCreateResponse = apply { if (!validated) { - connectionId() - companyId() - providerId() + accessToken() accountId() authenticationType() + companyId() + connectionId() products() - accessToken() + providerId() validated = true } } @@ -98,105 +112,96 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() - private var providerId: JsonField = JsonMissing.of() + private var accessToken: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() private var authenticationType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var products: JsonField> = JsonMissing.of() - private var accessToken: JsonField = JsonMissing.of() + private var providerId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountCreateResponse: AccountCreateResponse) = apply { - this.connectionId = accountCreateResponse.connectionId - 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) - } - - /** The ID of the new connection */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** The ID of the new connection */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accessToken = accountCreateResponse.accessToken + accountId = accountCreateResponse.accountId + authenticationType = accountCreateResponse.authenticationType + companyId = accountCreateResponse.companyId + connectionId = accountCreateResponse.connectionId + products = accountCreateResponse.products + providerId = accountCreateResponse.providerId + additionalProperties = accountCreateResponse.additionalProperties.toMutableMap() } - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - - /** The ID of the provider associated with the `access_token` */ - fun providerId(providerId: String) = providerId(JsonField.of(providerId)) + fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) - /** The ID of the provider associated with the `access_token` */ - @JsonProperty("provider_id") - @ExcludeMissing - fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @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 } + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** The ID of the new connection */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + + /** The ID of the new connection */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } + 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)) + /** The ID of the provider associated with the `access_token` */ + fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - @JsonProperty("access_token") - @ExcludeMissing - fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } + /** The ID of the provider associated with the `access_token` */ + fun providerId(providerId: JsonField) = apply { this.providerId = providerId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AccountCreateResponse = AccountCreateResponse( - connectionId, - companyId, - providerId, + accessToken, accountId, authenticationType, + companyId, + connectionId, products.map { it.toImmutable() }, - accessToken, + providerId, additionalProperties.toImmutable(), ) } @@ -275,15 +280,15 @@ private constructor( return true } - return /* spotless:off */ other is AccountCreateResponse && connectionId == other.connectionId && companyId == other.companyId && providerId == other.providerId && accountId == other.accountId && authenticationType == other.authenticationType && products == other.products && accessToken == other.accessToken && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountCreateResponse && accessToken == other.accessToken && accountId == other.accountId && authenticationType == other.authenticationType && companyId == other.companyId && connectionId == other.connectionId && products == other.products && providerId == other.providerId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, providerId, accountId, authenticationType, products, accessToken, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accessToken, accountId, authenticationType, companyId, connectionId, products, providerId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountCreateResponse{connectionId=$connectionId, companyId=$companyId, providerId=$providerId, accountId=$accountId, authenticationType=$authenticationType, products=$products, accessToken=$accessToken, additionalProperties=$additionalProperties}" + "AccountCreateResponse{accessToken=$accessToken, accountId=$accountId, authenticationType=$authenticationType, companyId=$companyId, connectionId=$connectionId, products=$products, providerId=$providerId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt index e88964ff..39fb907d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountDisconnectParams.kt @@ -24,9 +24,8 @@ constructor( fun _additionalBodyProperties(): Map = additionalBodyProperties @JvmSynthetic - internal fun getBody(): Optional> { - return Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - } + internal fun getBody(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index 7ae91c5d..cee081a2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = AccountUpdateEvent.Builder::class) @NoAutoDetect class AccountUpdateEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): AccountUpdateEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,128 +110,128 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountUpdateEvent: AccountUpdateEvent) = apply { - this.connectionId = accountUpdateEvent.connectionId - this.companyId = accountUpdateEvent.companyId - this.accountId = accountUpdateEvent.accountId - this.eventType = accountUpdateEvent.eventType - this.data = accountUpdateEvent.data - additionalProperties(accountUpdateEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = accountUpdateEvent.accountId + companyId = accountUpdateEvent.companyId + connectionId = accountUpdateEvent.connectionId + data = accountUpdateEvent.data + eventType = accountUpdateEvent.eventType + additionalProperties = accountUpdateEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AccountUpdateEvent = AccountUpdateEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val status: JsonField, - private val authenticationMethod: JsonField, - private val additionalProperties: Map, + @JsonProperty("authentication_method") + @ExcludeMissing + private val authenticationMethod: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun status(): ConnectionStatusType = status.getRequired("status") - fun authenticationMethod(): AuthenticationMethod = authenticationMethod.getRequired("authentication_method") - @JsonProperty("status") @ExcludeMissing fun _status() = status + fun status(): ConnectionStatusType = status.getRequired("status") @JsonProperty("authentication_method") @ExcludeMissing fun _authenticationMethod() = authenticationMethod + @JsonProperty("status") @ExcludeMissing fun _status() = status + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { - status() authenticationMethod().validate() + status() validated = true } } @@ -237,70 +245,73 @@ private constructor( class Builder { - private var status: JsonField = JsonMissing.of() private var authenticationMethod: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { - this.status = data.status - this.authenticationMethod = data.authenticationMethod - additionalProperties(data.additionalProperties) + authenticationMethod = data.authenticationMethod + status = data.status + additionalProperties = data.additionalProperties.toMutableMap() } - fun status(status: ConnectionStatusType) = status(JsonField.of(status)) - - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } - fun authenticationMethod(authenticationMethod: AuthenticationMethod) = authenticationMethod(JsonField.of(authenticationMethod)) - @JsonProperty("authentication_method") - @ExcludeMissing fun authenticationMethod(authenticationMethod: JsonField) = apply { this.authenticationMethod = authenticationMethod } + fun status(status: ConnectionStatusType) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data( - status, authenticationMethod, + status, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = AuthenticationMethod.Builder::class) @NoAutoDetect class AuthenticationMethod + @JsonCreator private constructor( - private val type: JsonField, - private val benefitsSupport: JsonField, - private val supportedFields: JsonField, - private val additionalProperties: Map, + @JsonProperty("benefits_support") + @ExcludeMissing + private val benefitsSupport: JsonField = JsonMissing.of(), + @JsonProperty("supported_fields") + @ExcludeMissing + private val supportedFields: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The type of authentication method. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** * Each benefit type and their supported features. If the benefit type is not supported, * the property will be null @@ -313,7 +324,7 @@ private constructor( Optional.ofNullable(supportedFields.getNullable("supported_fields")) /** The type of authentication method. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** * Each benefit type and their supported features. If the benefit type is not supported, @@ -328,15 +339,20 @@ private constructor( @ExcludeMissing fun _supportedFields() = supportedFields + /** The type of authentication method. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AuthenticationMethod = apply { if (!validated) { - type() benefitsSupport().map { it.validate() } supportedFields().map { it.validate() } + type() validated = true } } @@ -350,27 +366,19 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var benefitsSupport: JsonField = JsonMissing.of() private var supportedFields: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(authenticationMethod: AuthenticationMethod) = apply { - this.type = authenticationMethod.type - this.benefitsSupport = authenticationMethod.benefitsSupport - this.supportedFields = authenticationMethod.supportedFields - additionalProperties(authenticationMethod.additionalProperties) + benefitsSupport = authenticationMethod.benefitsSupport + supportedFields = authenticationMethod.supportedFields + type = authenticationMethod.type + additionalProperties = authenticationMethod.additionalProperties.toMutableMap() } - /** The type of authentication method. */ - fun type(type: Type) = type(JsonField.of(type)) - - /** The type of authentication method. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - /** * Each benefit type and their supported features. If the benefit type is not * supported, the property will be null @@ -382,8 +390,6 @@ private constructor( * Each benefit type and their supported features. If the benefit type is not * supported, the property will be null */ - @JsonProperty("benefits_support") - @ExcludeMissing fun benefitsSupport(benefitsSupport: JsonField) = apply { this.benefitsSupport = benefitsSupport } @@ -393,20 +399,23 @@ private constructor( supportedFields(JsonField.of(supportedFields)) /** The supported data fields returned by our HR and payroll endpoints */ - @JsonProperty("supported_fields") - @ExcludeMissing fun supportedFields(supportedFields: JsonField) = apply { this.supportedFields = supportedFields } + /** The type of authentication method. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The type of authentication method. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -414,80 +423,103 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AuthenticationMethod = AuthenticationMethod( - type, benefitsSupport, supportedFields, + type, additionalProperties.toImmutable(), ) } /** The supported data fields returned by our HR and payroll endpoints */ - @JsonDeserialize(builder = SupportedFields.Builder::class) @NoAutoDetect class SupportedFields + @JsonCreator private constructor( - private val company: JsonField, - private val directory: JsonField, - private val individual: JsonField, - private val employment: JsonField, - private val payment: JsonField, - private val payStatement: JsonField, - private val payGroup: JsonField, - private val additionalProperties: Map, + @JsonProperty("company") + @ExcludeMissing + private val company: JsonField = JsonMissing.of(), + @JsonProperty("directory") + @ExcludeMissing + private val directory: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + private val employment: JsonField = JsonMissing.of(), + @JsonProperty("individual") + @ExcludeMissing + private val individual: JsonField = JsonMissing.of(), + @JsonProperty("pay_group") + @ExcludeMissing + private val payGroup: JsonField = JsonMissing.of(), + @JsonProperty("pay_statement") + @ExcludeMissing + private val payStatement: JsonField = JsonMissing.of(), + @JsonProperty("payment") + @ExcludeMissing + private val payment: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun company(): Optional = Optional.ofNullable(company.getNullable("company")) fun directory(): Optional = Optional.ofNullable(directory.getNullable("directory")) - fun individual(): Optional = - Optional.ofNullable(individual.getNullable("individual")) - fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) - fun payment(): Optional = - Optional.ofNullable(payment.getNullable("payment")) + fun individual(): Optional = + Optional.ofNullable(individual.getNullable("individual")) + + fun payGroup(): Optional = + Optional.ofNullable(payGroup.getNullable("pay_group")) fun payStatement(): Optional = Optional.ofNullable(payStatement.getNullable("pay_statement")) - fun payGroup(): Optional = - Optional.ofNullable(payGroup.getNullable("pay_group")) + fun payment(): Optional = + Optional.ofNullable(payment.getNullable("payment")) @JsonProperty("company") @ExcludeMissing fun _company() = company @JsonProperty("directory") @ExcludeMissing fun _directory() = directory - @JsonProperty("individual") @ExcludeMissing fun _individual() = individual - @JsonProperty("employment") @ExcludeMissing fun _employment() = employment - @JsonProperty("payment") @ExcludeMissing fun _payment() = payment + @JsonProperty("individual") @ExcludeMissing fun _individual() = individual + + @JsonProperty("pay_group") @ExcludeMissing fun _payGroup() = payGroup @JsonProperty("pay_statement") @ExcludeMissing fun _payStatement() = payStatement - @JsonProperty("pay_group") @ExcludeMissing fun _payGroup() = payGroup + @JsonProperty("payment") @ExcludeMissing fun _payment() = payment @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedFields = apply { if (!validated) { company().map { it.validate() } directory().map { it.validate() } - individual().map { it.validate() } employment().map { it.validate() } - payment().map { it.validate() } - payStatement().map { it.validate() } + individual().map { it.validate() } payGroup().map { it.validate() } + payStatement().map { it.validate() } + payment().map { it.validate() } validated = true } } @@ -503,30 +535,28 @@ private constructor( private var company: JsonField = JsonMissing.of() private var directory: JsonField = JsonMissing.of() - private var individual: JsonField = JsonMissing.of() private var employment: JsonField = JsonMissing.of() - private var payment: JsonField = JsonMissing.of() + private var individual: JsonField = JsonMissing.of() + private var payGroup: JsonField = JsonMissing.of() private var payStatement: JsonField = JsonMissing.of() - private var payGroup: JsonField = JsonMissing.of() + private var payment: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedFields: SupportedFields) = apply { - this.company = supportedFields.company - this.directory = supportedFields.directory - this.individual = supportedFields.individual - this.employment = supportedFields.employment - this.payment = supportedFields.payment - this.payStatement = supportedFields.payStatement - this.payGroup = supportedFields.payGroup - additionalProperties(supportedFields.additionalProperties) + company = supportedFields.company + directory = supportedFields.directory + employment = supportedFields.employment + individual = supportedFields.individual + payGroup = supportedFields.payGroup + payStatement = supportedFields.payStatement + payment = supportedFields.payment + additionalProperties = supportedFields.additionalProperties.toMutableMap() } fun company(company: SupportedCompanyFields) = company(JsonField.of(company)) - @JsonProperty("company") - @ExcludeMissing fun company(company: JsonField) = apply { this.company = company } @@ -534,64 +564,51 @@ private constructor( fun directory(directory: SupportedDirectoryFields) = directory(JsonField.of(directory)) - @JsonProperty("directory") - @ExcludeMissing fun directory(directory: JsonField) = apply { this.directory = directory } + fun employment(employment: SupportedEmploymentFields) = + employment(JsonField.of(employment)) + + fun employment(employment: JsonField) = apply { + this.employment = employment + } + fun individual(individual: SupportedIndividualFields) = individual(JsonField.of(individual)) - @JsonProperty("individual") - @ExcludeMissing fun individual(individual: JsonField) = apply { this.individual = individual } - fun employment(employment: SupportedEmploymentFields) = - employment(JsonField.of(employment)) - - @JsonProperty("employment") - @ExcludeMissing - fun employment(employment: JsonField) = apply { - this.employment = employment - } - - fun payment(payment: SupportedPaymentFields) = payment(JsonField.of(payment)) + fun payGroup(payGroup: SupportedPayGroupFields) = + payGroup(JsonField.of(payGroup)) - @JsonProperty("payment") - @ExcludeMissing - fun payment(payment: JsonField) = apply { - this.payment = payment + fun payGroup(payGroup: JsonField) = apply { + this.payGroup = payGroup } fun payStatement(payStatement: SupportedPayStatementFields) = payStatement(JsonField.of(payStatement)) - @JsonProperty("pay_statement") - @ExcludeMissing fun payStatement(payStatement: JsonField) = apply { this.payStatement = payStatement } - fun payGroup(payGroup: SupportedPayGroupFields) = - payGroup(JsonField.of(payGroup)) + fun payment(payment: SupportedPaymentFields) = payment(JsonField.of(payment)) - @JsonProperty("pay_group") - @ExcludeMissing - fun payGroup(payGroup: JsonField) = apply { - this.payGroup = payGroup + fun payment(payment: JsonField) = apply { + this.payment = payment } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -599,67 +616,100 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedFields = SupportedFields( company, directory, - individual, employment, - payment, - payStatement, + individual, payGroup, + payStatement, + payment, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = SupportedCompanyFields.Builder::class) @NoAutoDetect class SupportedCompanyFields + @JsonCreator private constructor( - private val id: JsonField, - private val legalName: JsonField, - private val entity: JsonField, - private val primaryEmail: JsonField, - private val primaryPhoneNumber: JsonField, - private val ein: JsonField, - private val accounts: JsonField, - private val departments: JsonField, - private val locations: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("accounts") + @ExcludeMissing + private val accounts: JsonField = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + private val departments: JsonField = JsonMissing.of(), + @JsonProperty("ein") + @ExcludeMissing + private val ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") + @ExcludeMissing + private val entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + private val legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + private val locations: JsonField = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + private val primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + private val primaryPhoneNumber: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun legalName(): Optional = - Optional.ofNullable(legalName.getNullable("legal_name")) + fun accounts(): Optional = + Optional.ofNullable(accounts.getNullable("accounts")) + + fun departments(): Optional = + Optional.ofNullable(departments.getNullable("departments")) + + fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun legalName(): Optional = + Optional.ofNullable(legalName.getNullable("legal_name")) + + fun locations(): Optional = + Optional.ofNullable(locations.getNullable("locations")) + fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun accounts(): Optional = - Optional.ofNullable(accounts.getNullable("accounts")) + @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts - fun departments(): Optional = - Optional.ofNullable(departments.getNullable("departments")) + @JsonProperty("departments") @ExcludeMissing fun _departments() = departments - fun locations(): Optional = - Optional.ofNullable(locations.getNullable("locations")) + @JsonProperty("ein") @ExcludeMissing fun _ein() = ein - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("entity") @ExcludeMissing fun _entity() = entity @JsonProperty("legal_name") @ExcludeMissing fun _legalName() = legalName - @JsonProperty("entity") @ExcludeMissing fun _entity() = entity + @JsonProperty("locations") @ExcludeMissing fun _locations() = locations @JsonProperty("primary_email") @ExcludeMissing @@ -669,29 +719,23 @@ private constructor( @ExcludeMissing fun _primaryPhoneNumber() = primaryPhoneNumber - @JsonProperty("ein") @ExcludeMissing fun _ein() = ein - - @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts - - @JsonProperty("departments") @ExcludeMissing fun _departments() = departments - - @JsonProperty("locations") @ExcludeMissing fun _locations() = locations - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedCompanyFields = apply { if (!validated) { id() - legalName() - entity().map { it.validate() } - primaryEmail() - primaryPhoneNumber() - ein() accounts().map { it.validate() } departments().map { it.validate() } + ein() + entity().map { it.validate() } + legalName() locations().map { it.validate() } + primaryEmail() + primaryPhoneNumber() validated = true } } @@ -706,56 +750,72 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 ein: JsonField = JsonMissing.of() private var accounts: JsonField = JsonMissing.of() private var departments: JsonField = JsonMissing.of() + private var ein: JsonField = JsonMissing.of() + private var entity: JsonField = JsonMissing.of() + private var legalName: JsonField = JsonMissing.of() private var locations: JsonField = JsonMissing.of() + private var primaryEmail: JsonField = JsonMissing.of() + private var primaryPhoneNumber: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedCompanyFields: SupportedCompanyFields) = apply { - this.id = supportedCompanyFields.id - this.legalName = supportedCompanyFields.legalName - this.entity = supportedCompanyFields.entity - this.primaryEmail = supportedCompanyFields.primaryEmail - this.primaryPhoneNumber = supportedCompanyFields.primaryPhoneNumber - this.ein = supportedCompanyFields.ein - this.accounts = supportedCompanyFields.accounts - this.departments = supportedCompanyFields.departments - this.locations = supportedCompanyFields.locations - additionalProperties(supportedCompanyFields.additionalProperties) + id = supportedCompanyFields.id + accounts = supportedCompanyFields.accounts + departments = supportedCompanyFields.departments + ein = supportedCompanyFields.ein + entity = supportedCompanyFields.entity + legalName = supportedCompanyFields.legalName + locations = supportedCompanyFields.locations + primaryEmail = supportedCompanyFields.primaryEmail + primaryPhoneNumber = supportedCompanyFields.primaryPhoneNumber + additionalProperties = + supportedCompanyFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts)) + + fun accounts(accounts: JsonField) = apply { + this.accounts = accounts + } + + fun departments(departments: Departments) = + departments(JsonField.of(departments)) + + fun departments(departments: JsonField) = apply { + this.departments = departments + } + + fun ein(ein: Boolean) = ein(JsonField.of(ein)) + + fun ein(ein: JsonField) = apply { this.ein = ein } + + fun entity(entity: Entity) = entity(JsonField.of(entity)) + + fun entity(entity: JsonField) = apply { this.entity = entity } + fun legalName(legalName: Boolean) = legalName(JsonField.of(legalName)) - @JsonProperty("legal_name") - @ExcludeMissing fun legalName(legalName: JsonField) = apply { this.legalName = legalName } - fun entity(entity: Entity) = entity(JsonField.of(entity)) + fun locations(locations: Locations) = locations(JsonField.of(locations)) - @JsonProperty("entity") - @ExcludeMissing - fun entity(entity: JsonField) = apply { this.entity = entity } + fun locations(locations: JsonField) = apply { + this.locations = locations + } fun primaryEmail(primaryEmail: Boolean) = primaryEmail(JsonField.of(primaryEmail)) - @JsonProperty("primary_email") - @ExcludeMissing fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -763,133 +823,119 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: Boolean) = primaryPhoneNumber(JsonField.of(primaryPhoneNumber)) - @JsonProperty("primary_phone_number") - @ExcludeMissing fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } - fun ein(ein: Boolean) = ein(JsonField.of(ein)) - - @JsonProperty("ein") - @ExcludeMissing - fun ein(ein: JsonField) = apply { this.ein = ein } - - fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts)) - - @JsonProperty("accounts") - @ExcludeMissing - fun accounts(accounts: JsonField) = apply { - this.accounts = accounts - } - - fun departments(departments: Departments) = - departments(JsonField.of(departments)) - - @JsonProperty("departments") - @ExcludeMissing - fun departments(departments: JsonField) = apply { - this.departments = departments - } - - fun locations(locations: Locations) = locations(JsonField.of(locations)) - - @JsonProperty("locations") - @ExcludeMissing - fun locations(locations: JsonField) = apply { - this.locations = locations - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedCompanyFields = SupportedCompanyFields( id, - legalName, - entity, - primaryEmail, - primaryPhoneNumber, - ein, accounts, departments, + ein, + entity, + legalName, locations, + primaryEmail, + primaryPhoneNumber, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Accounts.Builder::class) @NoAutoDetect class Accounts + @JsonCreator 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, + @JsonProperty("account_name") + @ExcludeMissing + private val accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + private val accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + private val accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + private val institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + private val routingNumber: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) - fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) - fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + fun accountNumber(): Optional = + Optional.ofNullable(accountNumber.getNullable("account_number")) fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) - fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + fun institutionName(): Optional = + Optional.ofNullable(institutionName.getNullable("institution_name")) - @JsonProperty("routing_number") - @ExcludeMissing - fun _routingNumber() = routingNumber + fun routingNumber(): Optional = + Optional.ofNullable(routingNumber.getNullable("routing_number")) @JsonProperty("account_name") @ExcludeMissing fun _accountName() = accountName - @JsonProperty("institution_name") + @JsonProperty("account_number") @ExcludeMissing - fun _institutionName() = institutionName + fun _accountNumber() = accountNumber @JsonProperty("account_type") @ExcludeMissing fun _accountType() = accountType - @JsonProperty("account_number") + @JsonProperty("institution_name") @ExcludeMissing - fun _accountNumber() = accountNumber + fun _institutionName() = institutionName + + @JsonProperty("routing_number") + @ExcludeMissing + fun _routingNumber() = routingNumber @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Accounts = apply { if (!validated) { - routingNumber() accountName() - institutionName() - accountType() accountNumber() + accountType() + institutionName() + routingNumber() validated = true } } @@ -903,91 +949,88 @@ private constructor( 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 accountType: JsonField = JsonMissing.of() + private var institutionName: JsonField = JsonMissing.of() + private var routingNumber: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accounts: Accounts) = apply { - this.routingNumber = accounts.routingNumber - this.accountName = accounts.accountName - this.institutionName = accounts.institutionName - this.accountType = accounts.accountType - this.accountNumber = accounts.accountNumber - additionalProperties(accounts.additionalProperties) - } - - fun routingNumber(routingNumber: Boolean) = - routingNumber(JsonField.of(routingNumber)) - - @JsonProperty("routing_number") - @ExcludeMissing - fun routingNumber(routingNumber: JsonField) = apply { - this.routingNumber = routingNumber + accountName = accounts.accountName + accountNumber = accounts.accountNumber + accountType = accounts.accountType + institutionName = accounts.institutionName + routingNumber = accounts.routingNumber + additionalProperties = accounts.additionalProperties.toMutableMap() } fun accountName(accountName: Boolean) = accountName(JsonField.of(accountName)) - @JsonProperty("account_name") - @ExcludeMissing fun accountName(accountName: JsonField) = apply { this.accountName = accountName } - fun institutionName(institutionName: Boolean) = - institutionName(JsonField.of(institutionName)) + fun accountNumber(accountNumber: Boolean) = + accountNumber(JsonField.of(accountNumber)) - @JsonProperty("institution_name") - @ExcludeMissing - fun institutionName(institutionName: JsonField) = apply { - this.institutionName = institutionName + fun accountNumber(accountNumber: JsonField) = apply { + this.accountNumber = accountNumber } fun accountType(accountType: Boolean) = accountType(JsonField.of(accountType)) - @JsonProperty("account_type") - @ExcludeMissing fun accountType(accountType: JsonField) = apply { this.accountType = accountType } - fun accountNumber(accountNumber: Boolean) = - accountNumber(JsonField.of(accountNumber)) + fun institutionName(institutionName: Boolean) = + institutionName(JsonField.of(institutionName)) - @JsonProperty("account_number") - @ExcludeMissing - fun accountNumber(accountNumber: JsonField) = apply { - this.accountNumber = accountNumber + fun institutionName(institutionName: JsonField) = apply { + this.institutionName = institutionName + } + + fun routingNumber(routingNumber: Boolean) = + routingNumber(JsonField.of(routingNumber)) + + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Accounts = Accounts( - routingNumber, accountName, - institutionName, - accountType, accountNumber, + accountType, + institutionName, + routingNumber, additionalProperties.toImmutable(), ) } @@ -997,30 +1040,34 @@ private constructor( return true } - return /* spotless:off */ other is Accounts && routingNumber == other.routingNumber && accountName == other.accountName && institutionName == other.institutionName && accountType == other.accountType && accountNumber == other.accountNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Accounts && accountName == other.accountName && accountNumber == other.accountNumber && accountType == other.accountType && institutionName == other.institutionName && routingNumber == other.routingNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(routingNumber, accountName, institutionName, accountType, accountNumber, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountName, accountNumber, accountType, institutionName, routingNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Accounts{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + "Accounts{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Departments.Builder::class) @NoAutoDetect class Departments + @JsonCreator private constructor( - private val name: JsonField, - private val parent: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("parent") + @ExcludeMissing + private val parent: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -1035,6 +1082,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Departments = apply { if (!validated) { name() @@ -1059,38 +1108,42 @@ private constructor( @JvmSynthetic internal fun from(departments: Departments) = apply { - this.name = departments.name - this.parent = departments.parent - additionalProperties(departments.additionalProperties) + name = departments.name + parent = departments.parent + additionalProperties = + departments.additionalProperties.toMutableMap() } fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun parent(parent: Parent) = parent(JsonField.of(parent)) - @JsonProperty("parent") - @ExcludeMissing fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Departments = Departments( name, @@ -1099,16 +1152,18 @@ private constructor( ) } - @JsonDeserialize(builder = Parent.Builder::class) @NoAutoDetect class Parent + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -1119,6 +1174,8 @@ private constructor( fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Parent = apply { if (!validated) { name() @@ -1141,32 +1198,38 @@ private constructor( @JvmSynthetic internal fun from(parent: Parent) = apply { - this.name = parent.name - additionalProperties(parent.additionalProperties) + name = parent.name + additionalProperties = + parent.additionalProperties.toMutableMap() } fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun additionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -1207,35 +1270,41 @@ private constructor( "Departments{name=$name, parent=$parent, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Entity.Builder::class) @NoAutoDetect class Entity + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun subtype(): Optional = + Optional.ofNullable(subtype.getNullable("subtype")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun subtype(): Optional = - Optional.ofNullable(subtype.getNullable("subtype")) + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Entity = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -1249,51 +1318,54 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = entity.subtype + type = entity.type + additionalProperties = entity.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) - @JsonProperty("subtype") - @ExcludeMissing fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Entity = Entity( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -1303,33 +1375,51 @@ private constructor( return true } - return /* spotless:off */ other is Entity && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Entity && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Locations.Builder::class) @NoAutoDetect class Locations + @JsonCreator private constructor( - private val line1: JsonField, - private val line2: JsonField, - private val city: JsonField, - private val state: JsonField, - private val postalCode: JsonField, - private val country: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + private val line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + private val state: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun city(): Optional = + Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = + Optional.ofNullable(country.getNullable("country")) fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) @@ -1337,42 +1427,38 @@ private constructor( fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = - Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Locations = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -1386,90 +1472,85 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(locations: Locations) = apply { - this.line1 = locations.line1 - this.line2 = locations.line2 - this.city = locations.city - this.state = locations.state - this.postalCode = locations.postalCode - this.country = locations.country - additionalProperties(locations.additionalProperties) + city = locations.city + country = locations.country + line1 = locations.line1 + line2 = locations.line2 + postalCode = locations.postalCode + state = locations.state + additionalProperties = locations.additionalProperties.toMutableMap() } - fun line1(line1: Boolean) = line1(JsonField.of(line1)) + fun city(city: Boolean) = city(JsonField.of(city)) - @JsonProperty("line1") - @ExcludeMissing - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: Boolean) = line2(JsonField.of(line2)) + fun country(country: Boolean) = country(JsonField.of(country)) - @JsonProperty("line2") - @ExcludeMissing - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { + this.country = country + } - fun city(city: Boolean) = city(JsonField.of(city)) + fun line1(line1: Boolean) = line1(JsonField.of(line1)) - @JsonProperty("city") - @ExcludeMissing - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: Boolean) = state(JsonField.of(state)) + fun line2(line2: Boolean) = line2(JsonField.of(line2)) - @JsonProperty("state") - @ExcludeMissing - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: Boolean) = country(JsonField.of(country)) + fun state(state: Boolean) = state(JsonField.of(state)) - @JsonProperty("country") - @ExcludeMissing - fun country(country: JsonField) = apply { - this.country = country - } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Locations = Locations( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1479,17 +1560,17 @@ private constructor( return true } - return /* spotless:off */ other is Locations && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Locations && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Locations{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "Locations{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1497,48 +1578,53 @@ private constructor( return true } - return /* spotless:off */ other is SupportedCompanyFields && id == other.id && legalName == other.legalName && entity == other.entity && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && ein == other.ein && accounts == other.accounts && departments == other.departments && locations == other.locations && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedCompanyFields && id == other.id && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, legalName, entity, primaryEmail, primaryPhoneNumber, ein, accounts, departments, locations, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedCompanyFields{id=$id, legalName=$legalName, entity=$entity, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, ein=$ein, accounts=$accounts, departments=$departments, locations=$locations, additionalProperties=$additionalProperties}" + "SupportedCompanyFields{id=$id, accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedDirectoryFields.Builder::class) @NoAutoDetect class SupportedDirectoryFields + @JsonCreator private constructor( - private val paging: JsonField, - private val individuals: JsonField, - private val additionalProperties: Map, + @JsonProperty("individuals") + @ExcludeMissing + private val individuals: JsonField = JsonMissing.of(), + @JsonProperty("paging") + @ExcludeMissing + private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun individuals(): Optional = + Optional.ofNullable(individuals.getNullable("individuals")) fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) - fun individuals(): Optional = - Optional.ofNullable(individuals.getNullable("individuals")) + @JsonProperty("individuals") @ExcludeMissing fun _individuals() = individuals @JsonProperty("paging") @ExcludeMissing fun _paging() = paging - @JsonProperty("individuals") @ExcludeMissing fun _individuals() = individuals - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedDirectoryFields = apply { if (!validated) { - paging().map { it.validate() } individuals().map { it.validate() } + paging().map { it.validate() } validated = true } } @@ -1552,120 +1638,140 @@ private constructor( class Builder { - private var paging: JsonField = JsonMissing.of() private var individuals: JsonField = JsonMissing.of() + private var paging: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedDirectoryFields: SupportedDirectoryFields) = apply { - this.paging = supportedDirectoryFields.paging - this.individuals = supportedDirectoryFields.individuals - additionalProperties(supportedDirectoryFields.additionalProperties) + individuals = supportedDirectoryFields.individuals + paging = supportedDirectoryFields.paging + additionalProperties = + supportedDirectoryFields.additionalProperties.toMutableMap() } - fun paging(paging: Paging) = paging(JsonField.of(paging)) - - @JsonProperty("paging") - @ExcludeMissing - fun paging(paging: JsonField) = apply { this.paging = paging } - fun individuals(individuals: Individuals) = individuals(JsonField.of(individuals)) - @JsonProperty("individuals") - @ExcludeMissing fun individuals(individuals: JsonField) = apply { this.individuals = individuals } + fun paging(paging: Paging) = paging(JsonField.of(paging)) + + fun paging(paging: JsonField) = apply { this.paging = paging } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedDirectoryFields = SupportedDirectoryFields( - paging, individuals, + paging, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Individuals.Builder::class) @NoAutoDetect class Individuals + @JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val isActive: JsonField, - private val department: JsonField, - private val manager: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun department(): Optional = + Optional.ofNullable(department.getNullable("department")) + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) - - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun lastName(): Optional = + Optional.ofNullable(lastName.getNullable("last_name")) fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + @JsonProperty("department") @ExcludeMissing fun _department() = department - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - @JsonProperty("department") @ExcludeMissing fun _department() = department + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Individuals = apply { if (!validated) { id() + department() firstName() - middleName() - lastName() isActive() - department() + lastName() manager().map { it.validate() } + middleName() validated = true } } @@ -1680,121 +1786,117 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var department: JsonField = JsonMissing.of() private var firstName: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() - private var lastName: JsonField = JsonMissing.of() private var isActive: JsonField = JsonMissing.of() - private var department: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individuals: Individuals) = apply { - this.id = individuals.id - this.firstName = individuals.firstName - this.middleName = individuals.middleName - this.lastName = individuals.lastName - this.isActive = individuals.isActive - this.department = individuals.department - this.manager = individuals.manager - additionalProperties(individuals.additionalProperties) + id = individuals.id + department = individuals.department + firstName = individuals.firstName + isActive = individuals.isActive + lastName = individuals.lastName + manager = individuals.manager + middleName = individuals.middleName + additionalProperties = + individuals.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - - @JsonProperty("first_name") - @ExcludeMissing - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName - } - - fun middleName(middleName: Boolean) = - middleName(JsonField.of(middleName)) + fun department(department: Boolean) = + department(JsonField.of(department)) - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { - this.middleName = middleName + fun department(department: JsonField) = apply { + this.department = department } - fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { - this.lastName = lastName + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName } fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - @JsonProperty("is_active") - @ExcludeMissing fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - fun department(department: Boolean) = - department(JsonField.of(department)) + fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) - @JsonProperty("department") - @ExcludeMissing - fun department(department: JsonField) = apply { - this.department = department + fun lastName(lastName: JsonField) = apply { + this.lastName = lastName } fun manager(manager: Manager) = manager(JsonField.of(manager)) - @JsonProperty("manager") - @ExcludeMissing fun manager(manager: JsonField) = apply { this.manager = manager } + fun middleName(middleName: Boolean) = + middleName(JsonField.of(middleName)) + + fun middleName(middleName: JsonField) = apply { + this.middleName = middleName + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Individuals = Individuals( id, + department, firstName, - middleName, - lastName, isActive, - department, + lastName, manager, + middleName, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @JsonProperty("id") @ExcludeMissing fun _id() = id @@ -1804,6 +1906,8 @@ private constructor( fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -1826,32 +1930,38 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = + manager.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } fun additionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -1879,30 +1989,34 @@ private constructor( return true } - return /* spotless:off */ other is Individuals && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && isActive == other.isActive && department == other.department && manager == other.manager && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Individuals && id == other.id && department == other.department && firstName == other.firstName && isActive == other.isActive && lastName == other.lastName && manager == other.manager && middleName == other.middleName && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, isActive, department, manager, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, department, firstName, isActive, lastName, manager, middleName, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Individuals{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, isActive=$isActive, department=$department, manager=$manager, additionalProperties=$additionalProperties}" + "Individuals{id=$id, department=$department, firstName=$firstName, isActive=$isActive, lastName=$lastName, manager=$manager, middleName=$middleName, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Paging.Builder::class) @NoAutoDetect class Paging + @JsonCreator private constructor( - private val count: JsonField, - private val offset: JsonField, - private val additionalProperties: Map, + @JsonProperty("count") + @ExcludeMissing + private val count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + private val offset: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun count(): Optional = Optional.ofNullable(count.getNullable("count")) @@ -1917,6 +2031,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Paging = apply { if (!validated) { count() @@ -1941,38 +2057,41 @@ private constructor( @JvmSynthetic internal fun from(paging: Paging) = apply { - this.count = paging.count - this.offset = paging.offset - additionalProperties(paging.additionalProperties) + count = paging.count + offset = paging.offset + additionalProperties = paging.additionalProperties.toMutableMap() } fun count(count: Boolean) = count(JsonField.of(count)) - @JsonProperty("count") - @ExcludeMissing fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) - @JsonProperty("offset") - @ExcludeMissing fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Paging = Paging( count, @@ -2004,73 +2123,80 @@ private constructor( return true } - return /* spotless:off */ other is SupportedDirectoryFields && paging == other.paging && individuals == other.individuals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedDirectoryFields && individuals == other.individuals && paging == other.paging && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(paging, individuals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(individuals, paging, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedDirectoryFields{paging=$paging, individuals=$individuals, additionalProperties=$additionalProperties}" + "SupportedDirectoryFields{individuals=$individuals, paging=$paging, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedEmploymentFields.Builder::class) @NoAutoDetect class SupportedEmploymentFields + @JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val title: JsonField, - private val startDate: JsonField, - private val endDate: JsonField, - private val isActive: JsonField, - private val employmentStatus: JsonField, - private val incomeHistory: JsonField, - private val classCode: JsonField, - private val customFields: JsonField, - private val department: JsonField, - private val employment: JsonField, - private val income: JsonField, - private val location: JsonField, - private val manager: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") + @ExcludeMissing + private val classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + private val customFields: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + private val employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + private val employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") + @ExcludeMissing + private val income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + private val incomeHistory: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + private val location: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") + @ExcludeMissing + private val title: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) - - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) - - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) - - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - - fun startDate(): Optional = - Optional.ofNullable(startDate.getNullable("start_date")) - - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) - - fun isActive(): Optional = - Optional.ofNullable(isActive.getNullable("is_active")) - - fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) - - fun incomeHistory(): Optional = - Optional.ofNullable(incomeHistory.getNullable("income_history")) - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) @@ -2083,78 +2209,106 @@ private constructor( fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) + fun employmentStatus(): Optional = + Optional.ofNullable(employmentStatus.getNullable("employment_status")) + + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) + + fun firstName(): Optional = + Optional.ofNullable(firstName.getNullable("first_name")) + fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun incomeHistory(): Optional = + Optional.ofNullable(incomeHistory.getNullable("income_history")) + + fun isActive(): Optional = + Optional.ofNullable(isActive.getNullable("is_active")) + + fun lastName(): Optional = + Optional.ofNullable(lastName.getNullable("last_name")) + fun location(): Optional = Optional.ofNullable(location.getNullable("location")) fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + fun startDate(): Optional = + Optional.ofNullable(startDate.getNullable("start_date")) - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("title") @ExcludeMissing fun _title() = title + @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("custom_fields") + @ExcludeMissing + fun _customFields() = customFields - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("department") @ExcludeMissing fun _department() = department - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + @JsonProperty("employment") @ExcludeMissing fun _employment() = employment @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus() = employmentStatus + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + + @JsonProperty("income") @ExcludeMissing fun _income() = income + @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory() = incomeHistory - @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - @JsonProperty("custom_fields") - @ExcludeMissing - fun _customFields() = customFields + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName - @JsonProperty("department") @ExcludeMissing fun _department() = department + @JsonProperty("location") @ExcludeMissing fun _location() = location - @JsonProperty("employment") @ExcludeMissing fun _employment() = employment + @JsonProperty("manager") @ExcludeMissing fun _manager() = manager - @JsonProperty("income") @ExcludeMissing fun _income() = income + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName - @JsonProperty("location") @ExcludeMissing fun _location() = location + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + @JsonProperty("title") @ExcludeMissing fun _title() = title @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedEmploymentFields = apply { if (!validated) { id() - firstName() - middleName() - lastName() - title() - startDate() - endDate() - isActive() - employmentStatus() - incomeHistory() classCode() customFields() department().map { it.validate() } employment().map { it.validate() } + employmentStatus() + endDate() + firstName() income().map { it.validate() } + incomeHistory() + isActive() + lastName() location().map { it.validate() } manager().map { it.validate() } + middleName() + startDate() + title() validated = true } } @@ -2169,227 +2323,203 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var isActive: JsonField = JsonMissing.of() - private var employmentStatus: JsonField = JsonMissing.of() - private var incomeHistory: JsonField = JsonMissing.of() private var classCode: JsonField = JsonMissing.of() private var customFields: JsonField = JsonMissing.of() private var department: JsonField = JsonMissing.of() private var employment: JsonField = JsonMissing.of() + private var employmentStatus: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() private var income: JsonField = JsonMissing.of() + private var incomeHistory: JsonField = JsonMissing.of() + private var isActive: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() private var location: JsonField = JsonMissing.of() private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var title: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedEmploymentFields: SupportedEmploymentFields) = apply { - this.id = supportedEmploymentFields.id - this.firstName = supportedEmploymentFields.firstName - this.middleName = supportedEmploymentFields.middleName - this.lastName = supportedEmploymentFields.lastName - this.title = supportedEmploymentFields.title - this.startDate = supportedEmploymentFields.startDate - this.endDate = supportedEmploymentFields.endDate - this.isActive = supportedEmploymentFields.isActive - this.employmentStatus = supportedEmploymentFields.employmentStatus - this.incomeHistory = supportedEmploymentFields.incomeHistory - this.classCode = supportedEmploymentFields.classCode - this.customFields = supportedEmploymentFields.customFields - this.department = supportedEmploymentFields.department - this.employment = supportedEmploymentFields.employment - this.income = supportedEmploymentFields.income - this.location = supportedEmploymentFields.location - this.manager = supportedEmploymentFields.manager - additionalProperties(supportedEmploymentFields.additionalProperties) + id = supportedEmploymentFields.id + classCode = supportedEmploymentFields.classCode + customFields = supportedEmploymentFields.customFields + department = supportedEmploymentFields.department + employment = supportedEmploymentFields.employment + employmentStatus = supportedEmploymentFields.employmentStatus + endDate = supportedEmploymentFields.endDate + firstName = supportedEmploymentFields.firstName + income = supportedEmploymentFields.income + incomeHistory = supportedEmploymentFields.incomeHistory + isActive = supportedEmploymentFields.isActive + lastName = supportedEmploymentFields.lastName + location = supportedEmploymentFields.location + manager = supportedEmploymentFields.manager + middleName = supportedEmploymentFields.middleName + startDate = supportedEmploymentFields.startDate + title = supportedEmploymentFields.title + additionalProperties = + supportedEmploymentFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - - @JsonProperty("first_name") - @ExcludeMissing - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName - } - - fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + fun classCode(classCode: Boolean) = classCode(JsonField.of(classCode)) - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { - this.middleName = middleName + fun classCode(classCode: JsonField) = apply { + this.classCode = classCode } - fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + fun customFields(customFields: Boolean) = + customFields(JsonField.of(customFields)) - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { - this.lastName = lastName + fun customFields(customFields: JsonField) = apply { + this.customFields = customFields } - fun title(title: Boolean) = title(JsonField.of(title)) - - @JsonProperty("title") - @ExcludeMissing - fun title(title: JsonField) = apply { this.title = title } - - fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + fun department(department: Department) = + department(JsonField.of(department)) - @JsonProperty("start_date") - @ExcludeMissing - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + fun department(department: JsonField) = apply { + this.department = department } - fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) - - @JsonProperty("end_date") - @ExcludeMissing - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + fun employment(employment: Employment) = + employment(JsonField.of(employment)) - @JsonProperty("is_active") - @ExcludeMissing - fun isActive(isActive: JsonField) = apply { - this.isActive = isActive + fun employment(employment: JsonField) = apply { + this.employment = employment } fun employmentStatus(employmentStatus: Boolean) = employmentStatus(JsonField.of(employmentStatus)) - @JsonProperty("employment_status") - @ExcludeMissing fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } - fun incomeHistory(incomeHistory: Boolean) = - incomeHistory(JsonField.of(incomeHistory)) + fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) - @JsonProperty("income_history") - @ExcludeMissing - fun incomeHistory(incomeHistory: JsonField) = apply { - this.incomeHistory = incomeHistory - } + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun classCode(classCode: Boolean) = classCode(JsonField.of(classCode)) + fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - @JsonProperty("class_code") - @ExcludeMissing - fun classCode(classCode: JsonField) = apply { - this.classCode = classCode + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName } - fun customFields(customFields: Boolean) = - customFields(JsonField.of(customFields)) + fun income(income: Income) = income(JsonField.of(income)) - @JsonProperty("custom_fields") - @ExcludeMissing - fun customFields(customFields: JsonField) = apply { - this.customFields = customFields - } + fun income(income: JsonField) = apply { this.income = income } - fun department(department: Department) = - department(JsonField.of(department)) + fun incomeHistory(incomeHistory: Boolean) = + incomeHistory(JsonField.of(incomeHistory)) - @JsonProperty("department") - @ExcludeMissing - fun department(department: JsonField) = apply { - this.department = department + fun incomeHistory(incomeHistory: JsonField) = apply { + this.incomeHistory = incomeHistory } - fun employment(employment: Employment) = - employment(JsonField.of(employment)) + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - @JsonProperty("employment") - @ExcludeMissing - fun employment(employment: JsonField) = apply { - this.employment = employment + fun isActive(isActive: JsonField) = apply { + this.isActive = isActive } - fun income(income: Income) = income(JsonField.of(income)) + fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) - @JsonProperty("income") - @ExcludeMissing - fun income(income: JsonField) = apply { this.income = income } + fun lastName(lastName: JsonField) = apply { + this.lastName = lastName + } fun location(location: Location) = location(JsonField.of(location)) - @JsonProperty("location") - @ExcludeMissing fun location(location: JsonField) = apply { this.location = location } fun manager(manager: Manager) = manager(JsonField.of(manager)) - @JsonProperty("manager") - @ExcludeMissing fun manager(manager: JsonField) = apply { this.manager = manager } + fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + + fun middleName(middleName: JsonField) = apply { + this.middleName = middleName + } + + fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + + fun title(title: Boolean) = title(JsonField.of(title)) + + fun title(title: JsonField) = apply { this.title = title } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedEmploymentFields = SupportedEmploymentFields( id, - firstName, - middleName, - lastName, - title, - startDate, - endDate, - isActive, - employmentStatus, - incomeHistory, classCode, customFields, department, employment, + employmentStatus, + endDate, + firstName, income, + incomeHistory, + isActive, + lastName, location, manager, + middleName, + startDate, + title, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -2399,6 +2529,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -2421,31 +2553,37 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = + department.additionalProperties.toMutableMap() } fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -2468,35 +2606,41 @@ private constructor( "Department{name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Employment.Builder::class) @NoAutoDetect class Employment + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun subtype(): Optional = + Optional.ofNullable(subtype.getNullable("subtype")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun subtype(): Optional = - Optional.ofNullable(subtype.getNullable("subtype")) + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Employment = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -2510,51 +2654,55 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = employment.subtype + type = employment.type + additionalProperties = + employment.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) - @JsonProperty("subtype") - @ExcludeMissing fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Employment = Employment( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -2564,31 +2712,37 @@ private constructor( return true } - return /* spotless:off */ other is Employment && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Employment && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Income.Builder::class) @NoAutoDetect class Income + @JsonCreator private constructor( - private val amount: JsonField, - private val currency: JsonField, - private val unit: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("unit") + @ExcludeMissing + private val unit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) @@ -2608,6 +2762,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Income = apply { if (!validated) { amount() @@ -2634,47 +2790,48 @@ private constructor( @JvmSynthetic internal fun from(income: Income) = apply { - this.amount = income.amount - this.currency = income.currency - this.unit = income.unit - additionalProperties(income.additionalProperties) + amount = income.amount + currency = income.currency + unit = income.unit + additionalProperties = income.additionalProperties.toMutableMap() } fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } fun unit(unit: Boolean) = unit(JsonField.of(unit)) - @JsonProperty("unit") - @ExcludeMissing fun unit(unit: JsonField) = apply { this.unit = unit } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Income = Income( amount, @@ -2702,20 +2859,38 @@ private constructor( "Income{amount=$amount, currency=$currency, unit=$unit, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Location.Builder::class) @NoAutoDetect class Location + @JsonCreator private constructor( - private val line1: JsonField, - private val line2: JsonField, - private val city: JsonField, - private val state: JsonField, - private val postalCode: JsonField, - private val country: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + private val line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + private val state: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun city(): Optional = + Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = + Optional.ofNullable(country.getNullable("country")) fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) @@ -2723,42 +2898,38 @@ private constructor( fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = - Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Location = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -2772,90 +2943,85 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(location: Location) = apply { - this.line1 = location.line1 - this.line2 = location.line2 - this.city = location.city - this.state = location.state - this.postalCode = location.postalCode - this.country = location.country - additionalProperties(location.additionalProperties) + city = location.city + country = location.country + line1 = location.line1 + line2 = location.line2 + postalCode = location.postalCode + state = location.state + additionalProperties = location.additionalProperties.toMutableMap() } - fun line1(line1: Boolean) = line1(JsonField.of(line1)) + fun city(city: Boolean) = city(JsonField.of(city)) - @JsonProperty("line1") - @ExcludeMissing - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: Boolean) = line2(JsonField.of(line2)) + fun country(country: Boolean) = country(JsonField.of(country)) - @JsonProperty("line2") - @ExcludeMissing - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { + this.country = country + } - fun city(city: Boolean) = city(JsonField.of(city)) + fun line1(line1: Boolean) = line1(JsonField.of(line1)) - @JsonProperty("city") - @ExcludeMissing - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: Boolean) = state(JsonField.of(state)) + fun line2(line2: Boolean) = line2(JsonField.of(line2)) - @JsonProperty("state") - @ExcludeMissing - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: Boolean) = country(JsonField.of(country)) + fun state(state: Boolean) = state(JsonField.of(state)) - @JsonProperty("country") - @ExcludeMissing - fun country(country: JsonField) = apply { - this.country = country - } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Location = Location( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -2865,29 +3031,31 @@ private constructor( return true } - return /* spotless:off */ other is Location && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Location && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Location{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "Location{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @JsonProperty("id") @ExcludeMissing fun _id() = id @@ -2896,6 +3064,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -2918,31 +3088,36 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -2969,128 +3144,155 @@ private constructor( return true } - return /* spotless:off */ other is SupportedEmploymentFields && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && title == other.title && startDate == other.startDate && endDate == other.endDate && isActive == other.isActive && employmentStatus == other.employmentStatus && incomeHistory == other.incomeHistory && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && income == other.income && location == other.location && manager == other.manager && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedEmploymentFields && id == other.id && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && location == other.location && manager == other.manager && middleName == other.middleName && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, title, startDate, endDate, isActive, employmentStatus, incomeHistory, classCode, customFields, department, employment, income, location, manager, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, location, manager, middleName, startDate, title, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedEmploymentFields{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, title=$title, startDate=$startDate, endDate=$endDate, isActive=$isActive, employmentStatus=$employmentStatus, incomeHistory=$incomeHistory, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, income=$income, location=$location, manager=$manager, additionalProperties=$additionalProperties}" + "SupportedEmploymentFields{id=$id, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, location=$location, manager=$manager, middleName=$middleName, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedIndividualFields.Builder::class) @NoAutoDetect class SupportedIndividualFields + @JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val preferredName: JsonField, - private val dob: JsonField, - private val gender: JsonField, - private val ethnicity: JsonField, - private val ssn: JsonField, - private val encryptedSsn: JsonField, - private val emails: JsonField, - private val phoneNumbers: JsonField, - private val residence: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dob") + @ExcludeMissing + private val dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + private val emails: JsonField = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + private val encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + private val ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") + @ExcludeMissing + private val gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + private val phoneNumbers: JsonField = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + private val preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + private val residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") + @ExcludeMissing + private val ssn: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) - - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) - - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) - - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) - fun gender(): Optional = - Optional.ofNullable(gender.getNullable("gender")) + fun emails(): Optional = + Optional.ofNullable(emails.getNullable("emails")) + + fun encryptedSsn(): Optional = + Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun firstName(): Optional = + Optional.ofNullable(firstName.getNullable("first_name")) - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun gender(): Optional = + Optional.ofNullable(gender.getNullable("gender")) - fun emails(): Optional = - Optional.ofNullable(emails.getNullable("emails")) + fun lastName(): Optional = + Optional.ofNullable(lastName.getNullable("last_name")) + + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) fun phoneNumbers(): Optional = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + fun preferredName(): Optional = + Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + @JsonProperty("dob") @ExcludeMissing fun _dob() = dob - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + @JsonProperty("emails") @ExcludeMissing fun _emails() = emails - @JsonProperty("preferred_name") + @JsonProperty("encrypted_ssn") @ExcludeMissing - fun _preferredName() = preferredName - - @JsonProperty("dob") @ExcludeMissing fun _dob() = dob - - @JsonProperty("gender") @ExcludeMissing fun _gender() = gender + fun _encryptedSsn() = encryptedSsn @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity() = ethnicity - @JsonProperty("ssn") @ExcludeMissing fun _ssn() = ssn + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName - @JsonProperty("encrypted_ssn") - @ExcludeMissing - fun _encryptedSsn() = encryptedSsn + @JsonProperty("gender") @ExcludeMissing fun _gender() = gender - @JsonProperty("emails") @ExcludeMissing fun _emails() = emails + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers() = phoneNumbers + @JsonProperty("preferred_name") + @ExcludeMissing + fun _preferredName() = preferredName + @JsonProperty("residence") @ExcludeMissing fun _residence() = residence + @JsonProperty("ssn") @ExcludeMissing fun _ssn() = ssn + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedIndividualFields = apply { if (!validated) { id() - firstName() - middleName() - lastName() - preferredName() dob() - gender() - ethnicity() - ssn() - encryptedSsn() emails().map { it.validate() } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() phoneNumbers().map { it.validate() } + preferredName() residence().map { it.validate() } + ssn() validated = true } } @@ -3105,182 +3307,168 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 dob: JsonField = JsonMissing.of() - private var gender: JsonField = JsonMissing.of() - private var ethnicity: JsonField = JsonMissing.of() - private var ssn: JsonField = JsonMissing.of() - private var encryptedSsn: JsonField = JsonMissing.of() private var emails: JsonField = JsonMissing.of() + private var encryptedSsn: JsonField = JsonMissing.of() + private var ethnicity: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() + private var gender: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var phoneNumbers: JsonField = JsonMissing.of() + private var preferredName: JsonField = JsonMissing.of() private var residence: JsonField = JsonMissing.of() + private var ssn: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedIndividualFields: SupportedIndividualFields) = apply { - this.id = supportedIndividualFields.id - this.firstName = supportedIndividualFields.firstName - this.middleName = supportedIndividualFields.middleName - this.lastName = supportedIndividualFields.lastName - this.preferredName = supportedIndividualFields.preferredName - this.dob = supportedIndividualFields.dob - this.gender = supportedIndividualFields.gender - this.ethnicity = supportedIndividualFields.ethnicity - this.ssn = supportedIndividualFields.ssn - this.encryptedSsn = supportedIndividualFields.encryptedSsn - this.emails = supportedIndividualFields.emails - this.phoneNumbers = supportedIndividualFields.phoneNumbers - this.residence = supportedIndividualFields.residence - additionalProperties(supportedIndividualFields.additionalProperties) + id = supportedIndividualFields.id + dob = supportedIndividualFields.dob + emails = supportedIndividualFields.emails + encryptedSsn = supportedIndividualFields.encryptedSsn + ethnicity = supportedIndividualFields.ethnicity + firstName = supportedIndividualFields.firstName + gender = supportedIndividualFields.gender + lastName = supportedIndividualFields.lastName + middleName = supportedIndividualFields.middleName + phoneNumbers = supportedIndividualFields.phoneNumbers + preferredName = supportedIndividualFields.preferredName + residence = supportedIndividualFields.residence + ssn = supportedIndividualFields.ssn + additionalProperties = + supportedIndividualFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + fun dob(dob: Boolean) = dob(JsonField.of(dob)) - @JsonProperty("first_name") - @ExcludeMissing - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName - } + fun dob(dob: JsonField) = apply { this.dob = dob } - fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + fun emails(emails: Emails) = emails(JsonField.of(emails)) - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { - this.middleName = middleName - } + fun emails(emails: JsonField) = apply { this.emails = emails } - fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + fun encryptedSsn(encryptedSsn: Boolean) = + encryptedSsn(JsonField.of(encryptedSsn)) - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { - this.lastName = lastName + fun encryptedSsn(encryptedSsn: JsonField) = apply { + this.encryptedSsn = encryptedSsn } - fun preferredName(preferredName: Boolean) = - preferredName(JsonField.of(preferredName)) + fun ethnicity(ethnicity: Boolean) = ethnicity(JsonField.of(ethnicity)) - @JsonProperty("preferred_name") - @ExcludeMissing - fun preferredName(preferredName: JsonField) = apply { - this.preferredName = preferredName + fun ethnicity(ethnicity: JsonField) = apply { + this.ethnicity = ethnicity } - fun dob(dob: Boolean) = dob(JsonField.of(dob)) + fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - @JsonProperty("dob") - @ExcludeMissing - fun dob(dob: JsonField) = apply { this.dob = dob } + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName + } fun gender(gender: Boolean) = gender(JsonField.of(gender)) - @JsonProperty("gender") - @ExcludeMissing fun gender(gender: JsonField) = apply { this.gender = gender } - fun ethnicity(ethnicity: Boolean) = ethnicity(JsonField.of(ethnicity)) + fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) - @JsonProperty("ethnicity") - @ExcludeMissing - fun ethnicity(ethnicity: JsonField) = apply { - this.ethnicity = ethnicity + fun lastName(lastName: JsonField) = apply { + this.lastName = lastName } - fun ssn(ssn: Boolean) = ssn(JsonField.of(ssn)) - - @JsonProperty("ssn") - @ExcludeMissing - fun ssn(ssn: JsonField) = apply { this.ssn = ssn } - - fun encryptedSsn(encryptedSsn: Boolean) = - encryptedSsn(JsonField.of(encryptedSsn)) + fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) - @JsonProperty("encrypted_ssn") - @ExcludeMissing - fun encryptedSsn(encryptedSsn: JsonField) = apply { - this.encryptedSsn = encryptedSsn + fun middleName(middleName: JsonField) = apply { + this.middleName = middleName } - fun emails(emails: Emails) = emails(JsonField.of(emails)) - - @JsonProperty("emails") - @ExcludeMissing - fun emails(emails: JsonField) = apply { this.emails = emails } - fun phoneNumbers(phoneNumbers: PhoneNumbers) = phoneNumbers(JsonField.of(phoneNumbers)) - @JsonProperty("phone_numbers") - @ExcludeMissing fun phoneNumbers(phoneNumbers: JsonField) = apply { this.phoneNumbers = phoneNumbers } + fun preferredName(preferredName: Boolean) = + preferredName(JsonField.of(preferredName)) + + fun preferredName(preferredName: JsonField) = apply { + this.preferredName = preferredName + } + fun residence(residence: Residence) = residence(JsonField.of(residence)) - @JsonProperty("residence") - @ExcludeMissing fun residence(residence: JsonField) = apply { this.residence = residence } + fun ssn(ssn: Boolean) = ssn(JsonField.of(ssn)) + + fun ssn(ssn: JsonField) = apply { this.ssn = ssn } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedIndividualFields = SupportedIndividualFields( id, - firstName, - middleName, - lastName, - preferredName, dob, - gender, - ethnicity, - ssn, - encryptedSsn, emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, phoneNumbers, + preferredName, residence, + ssn, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Emails.Builder::class) @NoAutoDetect class Emails + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) @@ -3295,6 +3483,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Emails = apply { if (!validated) { data() @@ -3319,38 +3509,41 @@ private constructor( @JvmSynthetic internal fun from(emails: Emails) = apply { - this.data = emails.data - this.type = emails.type - additionalProperties(emails.additionalProperties) + data = emails.data + type = emails.type + additionalProperties = emails.additionalProperties.toMutableMap() } fun data(data: Boolean) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Emails = Emails( data, @@ -3377,17 +3570,21 @@ private constructor( "Emails{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PhoneNumbers.Builder::class) @NoAutoDetect class PhoneNumbers + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) @@ -3402,6 +3599,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PhoneNumbers = apply { if (!validated) { data() @@ -3426,38 +3625,42 @@ private constructor( @JvmSynthetic internal fun from(phoneNumbers: PhoneNumbers) = apply { - this.data = phoneNumbers.data - this.type = phoneNumbers.type - additionalProperties(phoneNumbers.additionalProperties) + data = phoneNumbers.data + type = phoneNumbers.type + additionalProperties = + phoneNumbers.additionalProperties.toMutableMap() } fun data(data: Boolean) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PhoneNumbers = PhoneNumbers( data, @@ -3484,21 +3687,33 @@ private constructor( "PhoneNumbers{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Residence.Builder::class) @NoAutoDetect class Residence + @JsonCreator private constructor( - private val city: JsonField, - private val country: JsonField, - private val line1: JsonField, - private val line2: JsonField, - private val postalCode: JsonField, - private val state: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + private val line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + private val state: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) @@ -3533,6 +3748,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Residence = apply { if (!validated) { city() @@ -3565,71 +3782,66 @@ private constructor( @JvmSynthetic internal fun from(residence: Residence) = apply { - this.city = residence.city - this.country = residence.country - this.line1 = residence.line1 - this.line2 = residence.line2 - this.postalCode = residence.postalCode - this.state = residence.state - additionalProperties(residence.additionalProperties) + city = residence.city + country = residence.country + line1 = residence.line1 + line2 = residence.line2 + postalCode = residence.postalCode + state = residence.state + additionalProperties = residence.additionalProperties.toMutableMap() } fun city(city: Boolean) = city(JsonField.of(city)) - @JsonProperty("city") - @ExcludeMissing fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) - @JsonProperty("country") - @ExcludeMissing fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) - @JsonProperty("line1") - @ExcludeMissing fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) - @JsonProperty("line2") - @ExcludeMissing fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) - @JsonProperty("state") - @ExcludeMissing fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Residence = Residence( city, @@ -3665,64 +3877,73 @@ private constructor( return true } - return /* spotless:off */ other is SupportedIndividualFields && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && preferredName == other.preferredName && dob == other.dob && gender == other.gender && ethnicity == other.ethnicity && ssn == other.ssn && encryptedSsn == other.encryptedSsn && emails == other.emails && phoneNumbers == other.phoneNumbers && residence == other.residence && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedIndividualFields && id == other.id && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, preferredName, dob, gender, ethnicity, ssn, encryptedSsn, emails, phoneNumbers, residence, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedIndividualFields{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, preferredName=$preferredName, dob=$dob, gender=$gender, ethnicity=$ethnicity, ssn=$ssn, encryptedSsn=$encryptedSsn, emails=$emails, phoneNumbers=$phoneNumbers, residence=$residence, additionalProperties=$additionalProperties}" + "SupportedIndividualFields{id=$id, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedPayGroupFields.Builder::class) @NoAutoDetect class SupportedPayGroupFields + @JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val payFrequencies: JsonField, - private val individualIds: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun individualIds(): Optional = + Optional.ofNullable(individualIds.getNullable("individual_ids")) + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - fun individualIds(): Optional = - Optional.ofNullable(individualIds.getNullable("individual_ids")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("individual_ids") + @ExcludeMissing + fun _individualIds() = individualIds + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies - @JsonProperty("individual_ids") - @ExcludeMissing - fun _individualIds() = individualIds - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedPayGroupFields = apply { if (!validated) { id() + individualIds() name() payFrequencies() - individualIds() validated = true } } @@ -3737,73 +3958,73 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var individualIds: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var payFrequencies: JsonField = JsonMissing.of() - private var individualIds: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedPayGroupFields: SupportedPayGroupFields) = apply { - this.id = supportedPayGroupFields.id - this.name = supportedPayGroupFields.name - this.payFrequencies = supportedPayGroupFields.payFrequencies - this.individualIds = supportedPayGroupFields.individualIds - additionalProperties(supportedPayGroupFields.additionalProperties) + id = supportedPayGroupFields.id + individualIds = supportedPayGroupFields.individualIds + name = supportedPayGroupFields.name + payFrequencies = supportedPayGroupFields.payFrequencies + additionalProperties = + supportedPayGroupFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun individualIds(individualIds: Boolean) = + individualIds(JsonField.of(individualIds)) + + fun individualIds(individualIds: JsonField) = apply { + this.individualIds = individualIds + } + fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun payFrequencies(payFrequencies: Boolean) = payFrequencies(JsonField.of(payFrequencies)) - @JsonProperty("pay_frequencies") - @ExcludeMissing fun payFrequencies(payFrequencies: JsonField) = apply { this.payFrequencies = payFrequencies } - fun individualIds(individualIds: Boolean) = - individualIds(JsonField.of(individualIds)) - - @JsonProperty("individual_ids") - @ExcludeMissing - fun individualIds(individualIds: JsonField) = apply { - this.individualIds = individualIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedPayGroupFields = SupportedPayGroupFields( id, + individualIds, name, payFrequencies, - individualIds, additionalProperties.toImmutable(), ) } @@ -3813,30 +4034,33 @@ private constructor( return true } - return /* spotless:off */ other is SupportedPayGroupFields && id == other.id && name == other.name && payFrequencies == other.payFrequencies && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedPayGroupFields && id == other.id && individualIds == other.individualIds && name == other.name && payFrequencies == other.payFrequencies && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, payFrequencies, individualIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, individualIds, name, payFrequencies, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedPayGroupFields{id=$id, name=$name, payFrequencies=$payFrequencies, individualIds=$individualIds, additionalProperties=$additionalProperties}" + "SupportedPayGroupFields{id=$id, individualIds=$individualIds, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedPayStatementFields.Builder::class) @NoAutoDetect class SupportedPayStatementFields + @JsonCreator private constructor( - private val paging: JsonField, - private val payStatements: JsonField, - private val additionalProperties: Map, + @JsonProperty("paging") + @ExcludeMissing + private val paging: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + private val payStatements: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) @@ -3853,6 +4077,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedPayStatementFields = apply { if (!validated) { paging().map { it.validate() } @@ -3879,22 +4105,19 @@ private constructor( internal fun from( supportedPayStatementFields: SupportedPayStatementFields ) = apply { - this.paging = supportedPayStatementFields.paging - this.payStatements = supportedPayStatementFields.payStatements - additionalProperties(supportedPayStatementFields.additionalProperties) + paging = supportedPayStatementFields.paging + payStatements = supportedPayStatementFields.payStatements + additionalProperties = + supportedPayStatementFields.additionalProperties.toMutableMap() } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") - @ExcludeMissing fun paging(paging: JsonField) = apply { this.paging = paging } fun payStatements(payStatements: PayStatements) = payStatements(JsonField.of(payStatements)) - @JsonProperty("pay_statements") - @ExcludeMissing fun payStatements(payStatements: JsonField) = apply { this.payStatements = payStatements } @@ -3902,18 +4125,25 @@ private constructor( fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedPayStatementFields = SupportedPayStatementFields( paging, @@ -3922,17 +4152,21 @@ private constructor( ) } - @JsonDeserialize(builder = Paging.Builder::class) @NoAutoDetect class Paging + @JsonCreator private constructor( - private val count: JsonField, - private val offset: JsonField, - private val additionalProperties: Map, + @JsonProperty("count") + @ExcludeMissing + private val count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + private val offset: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun count(): Boolean = count.getRequired("count") fun offset(): Boolean = offset.getRequired("offset") @@ -3945,6 +4179,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Paging = apply { if (!validated) { count() @@ -3969,38 +4205,41 @@ private constructor( @JvmSynthetic internal fun from(paging: Paging) = apply { - this.count = paging.count - this.offset = paging.offset - additionalProperties(paging.additionalProperties) + count = paging.count + offset = paging.offset + additionalProperties = paging.additionalProperties.toMutableMap() } fun count(count: Boolean) = count(JsonField.of(count)) - @JsonProperty("count") - @ExcludeMissing fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) - @JsonProperty("offset") - @ExcludeMissing fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Paging = Paging( count, @@ -4027,43 +4266,47 @@ private constructor( "Paging{count=$count, offset=$offset, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PayStatements.Builder::class) @NoAutoDetect class PayStatements + @JsonCreator private constructor( - private val individualId: JsonField, - private val type: JsonField, - private val paymentMethod: JsonField, - private val totalHours: JsonField, - private val grossPay: JsonField, - private val netPay: JsonField, - private val earnings: JsonField, - private val employeeDeductions: JsonField, - private val employerContributions: JsonField, - private val taxes: JsonField, - private val additionalProperties: Map, + @JsonProperty("earnings") + @ExcludeMissing + private val earnings: JsonField = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + private val employeeDeductions: JsonField = + JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + private val employerContributions: JsonField = + JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + private val grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + private val netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + private val paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") + @ExcludeMissing + private val taxes: JsonField = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + private val totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) - - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) - - fun paymentMethod(): Optional = - Optional.ofNullable(paymentMethod.getNullable("payment_method")) - - fun totalHours(): Optional = - Optional.ofNullable(totalHours.getNullable("total_hours")) - - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) - - fun netPay(): Optional = - Optional.ofNullable(netPay.getNullable("net_pay")) - fun earnings(): Optional = Optional.ofNullable(earnings.getNullable("earnings")) @@ -4077,24 +4320,26 @@ private constructor( employerContributions.getNullable("employer_contributions") ) - fun taxes(): Optional = - Optional.ofNullable(taxes.getNullable("taxes")) + fun grossPay(): Optional = + Optional.ofNullable(grossPay.getNullable("gross_pay")) - @JsonProperty("individual_id") - @ExcludeMissing - fun _individualId() = individualId + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun netPay(): Optional = + Optional.ofNullable(netPay.getNullable("net_pay")) - @JsonProperty("payment_method") - @ExcludeMissing - fun _paymentMethod() = paymentMethod + fun paymentMethod(): Optional = + Optional.ofNullable(paymentMethod.getNullable("payment_method")) - @JsonProperty("total_hours") @ExcludeMissing fun _totalHours() = totalHours + fun taxes(): Optional = + Optional.ofNullable(taxes.getNullable("taxes")) - @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + fun totalHours(): Optional = + Optional.ofNullable(totalHours.getNullable("total_hours")) - @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + fun type(): Optional = + Optional.ofNullable(type.getNullable("type")) @JsonProperty("earnings") @ExcludeMissing fun _earnings() = earnings @@ -4106,24 +4351,42 @@ private constructor( @ExcludeMissing fun _employerContributions() = employerContributions + @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + + @JsonProperty("individual_id") + @ExcludeMissing + fun _individualId() = individualId + + @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + + @JsonProperty("payment_method") + @ExcludeMissing + fun _paymentMethod() = paymentMethod + @JsonProperty("taxes") @ExcludeMissing fun _taxes() = taxes + @JsonProperty("total_hours") @ExcludeMissing fun _totalHours() = totalHours + + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayStatements = apply { if (!validated) { - individualId() - type() - paymentMethod() - totalHours() - grossPay() - netPay() earnings().map { it.validate() } employeeDeductions().map { it.validate() } employerContributions().map { it.validate() } + grossPay() + individualId() + netPay() + paymentMethod() taxes().map { it.validate() } + totalHours() + type() validated = true } } @@ -4137,191 +4400,189 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var paymentMethod: JsonField = JsonMissing.of() - private var totalHours: JsonField = JsonMissing.of() - private var grossPay: JsonField = JsonMissing.of() - private var netPay: JsonField = JsonMissing.of() private var earnings: JsonField = JsonMissing.of() private var employeeDeductions: JsonField = JsonMissing.of() private var employerContributions: JsonField = JsonMissing.of() + private var grossPay: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() + private var netPay: JsonField = JsonMissing.of() + private var paymentMethod: JsonField = JsonMissing.of() private var taxes: JsonField = JsonMissing.of() + private var totalHours: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payStatements: PayStatements) = apply { - this.individualId = payStatements.individualId - this.type = payStatements.type - this.paymentMethod = payStatements.paymentMethod - this.totalHours = payStatements.totalHours - this.grossPay = payStatements.grossPay - this.netPay = payStatements.netPay - this.earnings = payStatements.earnings - this.employeeDeductions = payStatements.employeeDeductions - this.employerContributions = payStatements.employerContributions - this.taxes = payStatements.taxes - additionalProperties(payStatements.additionalProperties) + earnings = payStatements.earnings + employeeDeductions = payStatements.employeeDeductions + employerContributions = payStatements.employerContributions + grossPay = payStatements.grossPay + individualId = payStatements.individualId + netPay = payStatements.netPay + paymentMethod = payStatements.paymentMethod + taxes = payStatements.taxes + totalHours = payStatements.totalHours + type = payStatements.type + additionalProperties = + payStatements.additionalProperties.toMutableMap() } - fun individualId(individualId: Boolean) = - individualId(JsonField.of(individualId)) + fun earnings(earnings: Earnings) = earnings(JsonField.of(earnings)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId + fun earnings(earnings: JsonField) = apply { + this.earnings = earnings } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun paymentMethod(paymentMethod: Boolean) = - paymentMethod(JsonField.of(paymentMethod)) + fun employeeDeductions(employeeDeductions: EmployeeDeductions) = + employeeDeductions(JsonField.of(employeeDeductions)) - @JsonProperty("payment_method") - @ExcludeMissing - fun paymentMethod(paymentMethod: JsonField) = apply { - this.paymentMethod = paymentMethod - } + fun employeeDeductions( + employeeDeductions: JsonField + ) = apply { this.employeeDeductions = employeeDeductions } - fun totalHours(totalHours: Boolean) = - totalHours(JsonField.of(totalHours)) + fun employerContributions( + employerContributions: EmployerContributions + ) = employerContributions(JsonField.of(employerContributions)) - @JsonProperty("total_hours") - @ExcludeMissing - fun totalHours(totalHours: JsonField) = apply { - this.totalHours = totalHours - } + fun employerContributions( + employerContributions: JsonField + ) = apply { this.employerContributions = employerContributions } fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) - @JsonProperty("gross_pay") - @ExcludeMissing fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } + fun individualId(individualId: Boolean) = + individualId(JsonField.of(individualId)) + + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } + fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) - @JsonProperty("net_pay") - @ExcludeMissing fun netPay(netPay: JsonField) = apply { this.netPay = netPay } - fun earnings(earnings: Earnings) = earnings(JsonField.of(earnings)) + fun paymentMethod(paymentMethod: Boolean) = + paymentMethod(JsonField.of(paymentMethod)) - @JsonProperty("earnings") - @ExcludeMissing - fun earnings(earnings: JsonField) = apply { - this.earnings = earnings + fun paymentMethod(paymentMethod: JsonField) = apply { + this.paymentMethod = paymentMethod } - fun employeeDeductions(employeeDeductions: EmployeeDeductions) = - employeeDeductions(JsonField.of(employeeDeductions)) + fun taxes(taxes: Taxes) = taxes(JsonField.of(taxes)) - @JsonProperty("employee_deductions") - @ExcludeMissing - fun employeeDeductions( - employeeDeductions: JsonField - ) = apply { this.employeeDeductions = employeeDeductions } + fun taxes(taxes: JsonField) = apply { this.taxes = taxes } - fun employerContributions( - employerContributions: EmployerContributions - ) = employerContributions(JsonField.of(employerContributions)) + fun totalHours(totalHours: Boolean) = + totalHours(JsonField.of(totalHours)) - @JsonProperty("employer_contributions") - @ExcludeMissing - fun employerContributions( - employerContributions: JsonField - ) = apply { this.employerContributions = employerContributions } + fun totalHours(totalHours: JsonField) = apply { + this.totalHours = totalHours + } - fun taxes(taxes: Taxes) = taxes(JsonField.of(taxes)) + fun type(type: Boolean) = type(JsonField.of(type)) - @JsonProperty("taxes") - @ExcludeMissing - fun taxes(taxes: JsonField) = apply { this.taxes = taxes } + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatements = PayStatements( - individualId, - type, - paymentMethod, - totalHours, - grossPay, - netPay, earnings, employeeDeductions, employerContributions, + grossPay, + individualId, + netPay, + paymentMethod, taxes, + totalHours, + type, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Earnings.Builder::class) @NoAutoDetect class Earnings + @JsonCreator private constructor( - private val type: JsonField, - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) - - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun name(): Optional = + Optional.ofNullable(name.getNullable("name")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun type(): Optional = + Optional.ofNullable(type.getNullable("type")) @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Earnings = apply { if (!validated) { - type() - name() amount() currency() + name() + type() validated = true } } @@ -4335,72 +4596,72 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(earnings: Earnings) = apply { - this.type = earnings.type - this.name = earnings.name - this.amount = earnings.amount - this.currency = earnings.currency - additionalProperties(earnings.additionalProperties) + amount = earnings.amount + currency = earnings.currency + name = earnings.name + type = earnings.type + additionalProperties = + earnings.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Earnings = Earnings( - type, - name, amount, currency, + name, + type, additionalProperties.toImmutable(), ) } @@ -4410,70 +4671,82 @@ private constructor( return true } - return /* spotless:off */ other is Earnings && type == other.type && name == other.name && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Earnings && amount == other.amount && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Earnings{type=$type, name=$name, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "Earnings{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployeeDeductions.Builder::class) @NoAutoDetect class EmployeeDeductions + @JsonCreator private constructor( - private val name: JsonField, - private val amount: JsonField, - private val type: JsonField, - private val preTax: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") + @ExcludeMissing + private val preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun amount(): Optional = + Optional.ofNullable(amount.getNullable("amount")) + + fun currency(): Optional = + Optional.ofNullable(currency.getNullable("currency")) fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun preTax(): Optional = + Optional.ofNullable(preTax.getNullable("pre_tax")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun preTax(): Optional = - Optional.ofNullable(preTax.getNullable("pre_tax")) + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("pre_tax") @ExcludeMissing fun _preTax() = preTax - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmployeeDeductions = apply { if (!validated) { - name() amount() - type() - preTax() currency() + name() + preTax() + type() validated = true } } @@ -4487,83 +4760,81 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var preTax: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var preTax: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employeeDeductions: EmployeeDeductions) = apply { - this.name = employeeDeductions.name - this.amount = employeeDeductions.amount - this.type = employeeDeductions.type - this.preTax = employeeDeductions.preTax - this.currency = employeeDeductions.currency - additionalProperties(employeeDeductions.additionalProperties) + amount = employeeDeductions.amount + currency = employeeDeductions.currency + name = employeeDeductions.name + preTax = employeeDeductions.preTax + type = employeeDeductions.type + additionalProperties = + employeeDeductions.additionalProperties.toMutableMap() } - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } - fun type(type: Boolean) = type(JsonField.of(type)) + fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } fun preTax(preTax: Boolean) = preTax(JsonField.of(preTax)) - @JsonProperty("pre_tax") - @ExcludeMissing fun preTax(preTax: JsonField) = apply { this.preTax = preTax } - fun currency(currency: Boolean) = currency(JsonField.of(currency)) + fun type(type: Boolean) = type(JsonField.of(type)) - @JsonProperty("currency") - @ExcludeMissing - fun currency(currency: JsonField) = apply { - this.currency = currency - } + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployeeDeductions = EmployeeDeductions( - name, amount, - type, - preTax, currency, + name, + preTax, + type, additionalProperties.toImmutable(), ) } @@ -4573,56 +4844,64 @@ private constructor( return true } - return /* spotless:off */ other is EmployeeDeductions && name == other.name && amount == other.amount && type == other.type && preTax == other.preTax && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployeeDeductions && amount == other.amount && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, type, preTax, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, preTax, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployeeDeductions{name=$name, amount=$amount, type=$type, preTax=$preTax, currency=$currency, additionalProperties=$additionalProperties}" + "EmployeeDeductions{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployerContributions.Builder::class) @NoAutoDetect class EmployerContributions + @JsonCreator private constructor( - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = + Optional.ofNullable(name.getNullable("name")) @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmployerContributions = apply { if (!validated) { - name() amount() currency() + name() validated = true } } @@ -4636,66 +4915,67 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employerContributions: EmployerContributions) = apply { - this.name = employerContributions.name - this.amount = employerContributions.amount - this.currency = employerContributions.currency - additionalProperties( + amount = employerContributions.amount + currency = employerContributions.currency + name = employerContributions.name + additionalProperties = employerContributions.additionalProperties - ) + .toMutableMap() } - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + fun additionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployerContributions = EmployerContributions( - name, amount, currency, + name, additionalProperties.toImmutable(), ) } @@ -4705,70 +4985,82 @@ private constructor( return true } - return /* spotless:off */ other is EmployerContributions && name == other.name && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployerContributions && amount == other.amount && currency == other.currency && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployerContributions{name=$name, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "EmployerContributions{amount=$amount, currency=$currency, name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Taxes.Builder::class) @NoAutoDetect class Taxes + @JsonCreator private constructor( - private val type: JsonField, - private val name: JsonField, - private val employer: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + private val employer: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) - - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) - - fun employer(): Optional = - Optional.ofNullable(employer.getNullable("employer")) - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun employer(): Optional = + Optional.ofNullable(employer.getNullable("employer")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = + Optional.ofNullable(name.getNullable("name")) - @JsonProperty("employer") @ExcludeMissing fun _employer() = employer + fun type(): Optional = + Optional.ofNullable(type.getNullable("type")) @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("employer") @ExcludeMissing fun _employer() = employer + + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Taxes = apply { if (!validated) { - type() - name() - employer() amount() currency() + employer() + name() + type() validated = true } } @@ -4782,83 +5074,80 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var employer: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var employer: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() - @JvmSynthetic - internal fun from(taxes: Taxes) = apply { - this.type = taxes.type - this.name = taxes.name - this.employer = taxes.employer - this.amount = taxes.amount - this.currency = taxes.currency - additionalProperties(taxes.additionalProperties) - } - - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - - fun employer(employer: Boolean) = employer(JsonField.of(employer)) - - @JsonProperty("employer") - @ExcludeMissing - fun employer(employer: JsonField) = apply { - this.employer = employer + @JvmSynthetic + internal fun from(taxes: Taxes) = apply { + amount = taxes.amount + currency = taxes.currency + employer = taxes.employer + name = taxes.name + type = taxes.type + additionalProperties = taxes.additionalProperties.toMutableMap() } fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + fun employer(employer: Boolean) = employer(JsonField.of(employer)) + + fun employer(employer: JsonField) = apply { + this.employer = employer + } + + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Taxes = Taxes( - type, - name, - employer, amount, currency, + employer, + name, + type, additionalProperties.toImmutable(), ) } @@ -4868,17 +5157,17 @@ private constructor( return true } - return /* spotless:off */ other is Taxes && type == other.type && name == other.name && employer == other.employer && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Taxes && amount == other.amount && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, employer, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, employer, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Taxes{type=$type, name=$name, employer=$employer, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "Taxes{amount=$amount, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -4886,17 +5175,17 @@ private constructor( return true } - return /* spotless:off */ other is PayStatements && individualId == other.individualId && type == other.type && paymentMethod == other.paymentMethod && totalHours == other.totalHours && grossPay == other.grossPay && netPay == other.netPay && earnings == other.earnings && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && taxes == other.taxes && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayStatements && earnings == other.earnings && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && grossPay == other.grossPay && individualId == other.individualId && netPay == other.netPay && paymentMethod == other.paymentMethod && taxes == other.taxes && totalHours == other.totalHours && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, type, paymentMethod, totalHours, grossPay, netPay, earnings, employeeDeductions, employerContributions, taxes, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(earnings, employeeDeductions, employerContributions, grossPay, individualId, netPay, paymentMethod, taxes, totalHours, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayStatements{individualId=$individualId, type=$type, paymentMethod=$paymentMethod, totalHours=$totalHours, grossPay=$grossPay, netPay=$netPay, earnings=$earnings, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, taxes=$taxes, additionalProperties=$additionalProperties}" + "PayStatements{earnings=$earnings, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, grossPay=$grossPay, individualId=$individualId, netPay=$netPay, paymentMethod=$paymentMethod, taxes=$taxes, totalHours=$totalHours, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -4917,114 +5206,139 @@ private constructor( "SupportedPayStatementFields{paging=$paging, payStatements=$payStatements, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedPaymentFields.Builder::class) @NoAutoDetect class SupportedPaymentFields + @JsonCreator private constructor( - private val id: JsonField, - private val payDate: JsonField, - private val debitDate: JsonField, - private val companyDebit: JsonField, - private val grossPay: JsonField, - private val netPay: JsonField, - private val employerTaxes: JsonField, - private val employeeTaxes: JsonField, - private val individualIds: JsonField, - private val payPeriod: JsonField, - private val payGroupIds: JsonField, - private val payFrequencies: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("company_debit") + @ExcludeMissing + private val companyDebit: JsonField = JsonMissing.of(), + @JsonProperty("debit_date") + @ExcludeMissing + private val debitDate: JsonField = JsonMissing.of(), + @JsonProperty("employee_taxes") + @ExcludeMissing + private val employeeTaxes: JsonField = JsonMissing.of(), + @JsonProperty("employer_taxes") + @ExcludeMissing + private val employerTaxes: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + private val grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + private val netPay: JsonField = JsonMissing.of(), + @JsonProperty("pay_date") + @ExcludeMissing + private val payDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField = JsonMissing.of(), + @JsonProperty("pay_group_ids") + @ExcludeMissing + private val payGroupIds: JsonField = JsonMissing.of(), + @JsonProperty("pay_period") + @ExcludeMissing + private val payPeriod: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun payDate(): Optional = - Optional.ofNullable(payDate.getNullable("pay_date")) - - fun debitDate(): Optional = - Optional.ofNullable(debitDate.getNullable("debit_date")) - fun companyDebit(): Optional = Optional.ofNullable(companyDebit.getNullable("company_debit")) - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun debitDate(): Optional = + Optional.ofNullable(debitDate.getNullable("debit_date")) - fun netPay(): Optional = - Optional.ofNullable(netPay.getNullable("net_pay")) + fun employeeTaxes(): Optional = + Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) fun employerTaxes(): Optional = Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) - fun employeeTaxes(): Optional = - Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + fun grossPay(): Optional = + Optional.ofNullable(grossPay.getNullable("gross_pay")) fun individualIds(): Optional = Optional.ofNullable(individualIds.getNullable("individual_ids")) - fun payPeriod(): Optional = - Optional.ofNullable(payPeriod.getNullable("pay_period")) + fun netPay(): Optional = + Optional.ofNullable(netPay.getNullable("net_pay")) - fun payGroupIds(): Optional = - Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + fun payDate(): Optional = + Optional.ofNullable(payDate.getNullable("pay_date")) fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun payGroupIds(): Optional = + Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) - @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate + fun payPeriod(): Optional = + Optional.ofNullable(payPeriod.getNullable("pay_period")) - @JsonProperty("debit_date") @ExcludeMissing fun _debitDate() = debitDate + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("company_debit") @ExcludeMissing fun _companyDebit() = companyDebit - @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + @JsonProperty("debit_date") @ExcludeMissing fun _debitDate() = debitDate - @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + @JsonProperty("employee_taxes") + @ExcludeMissing + fun _employeeTaxes() = employeeTaxes @JsonProperty("employer_taxes") @ExcludeMissing fun _employerTaxes() = employerTaxes - @JsonProperty("employee_taxes") - @ExcludeMissing - fun _employeeTaxes() = employeeTaxes + @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds - @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod + @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay - @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds + @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies + @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds + + @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedPaymentFields = apply { if (!validated) { id() - payDate() - debitDate() companyDebit() - grossPay() - netPay() - employerTaxes() + debitDate() employeeTaxes() + employerTaxes() + grossPay() individualIds() - payPeriod().map { it.validate() } - payGroupIds() + netPay() + payDate() payFrequencies() + payGroupIds() + payPeriod().map { it.validate() } validated = true } } @@ -5039,195 +5353,185 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var payDate: JsonField = JsonMissing.of() - private var debitDate: JsonField = JsonMissing.of() private var companyDebit: JsonField = JsonMissing.of() - private var grossPay: JsonField = JsonMissing.of() - private var netPay: JsonField = JsonMissing.of() - private var employerTaxes: JsonField = JsonMissing.of() + private var debitDate: JsonField = JsonMissing.of() private var employeeTaxes: JsonField = JsonMissing.of() + private var employerTaxes: JsonField = JsonMissing.of() + private var grossPay: JsonField = JsonMissing.of() private var individualIds: JsonField = JsonMissing.of() - private var payPeriod: JsonField = JsonMissing.of() - private var payGroupIds: JsonField = JsonMissing.of() + private var netPay: JsonField = JsonMissing.of() + private var payDate: JsonField = JsonMissing.of() private var payFrequencies: JsonField = JsonMissing.of() + private var payGroupIds: JsonField = JsonMissing.of() + private var payPeriod: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedPaymentFields: SupportedPaymentFields) = apply { - this.id = supportedPaymentFields.id - this.payDate = supportedPaymentFields.payDate - this.debitDate = supportedPaymentFields.debitDate - this.companyDebit = supportedPaymentFields.companyDebit - this.grossPay = supportedPaymentFields.grossPay - this.netPay = supportedPaymentFields.netPay - this.employerTaxes = supportedPaymentFields.employerTaxes - this.employeeTaxes = supportedPaymentFields.employeeTaxes - this.individualIds = supportedPaymentFields.individualIds - this.payPeriod = supportedPaymentFields.payPeriod - this.payGroupIds = supportedPaymentFields.payGroupIds - this.payFrequencies = supportedPaymentFields.payFrequencies - additionalProperties(supportedPaymentFields.additionalProperties) + id = supportedPaymentFields.id + companyDebit = supportedPaymentFields.companyDebit + debitDate = supportedPaymentFields.debitDate + employeeTaxes = supportedPaymentFields.employeeTaxes + employerTaxes = supportedPaymentFields.employerTaxes + grossPay = supportedPaymentFields.grossPay + individualIds = supportedPaymentFields.individualIds + netPay = supportedPaymentFields.netPay + payDate = supportedPaymentFields.payDate + payFrequencies = supportedPaymentFields.payFrequencies + payGroupIds = supportedPaymentFields.payGroupIds + payPeriod = supportedPaymentFields.payPeriod + additionalProperties = + supportedPaymentFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun payDate(payDate: Boolean) = payDate(JsonField.of(payDate)) - - @JsonProperty("pay_date") - @ExcludeMissing - fun payDate(payDate: JsonField) = apply { this.payDate = payDate } - - fun debitDate(debitDate: Boolean) = debitDate(JsonField.of(debitDate)) - - @JsonProperty("debit_date") - @ExcludeMissing - fun debitDate(debitDate: JsonField) = apply { - this.debitDate = debitDate - } - fun companyDebit(companyDebit: Boolean) = companyDebit(JsonField.of(companyDebit)) - @JsonProperty("company_debit") - @ExcludeMissing fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit } - fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) + fun debitDate(debitDate: Boolean) = debitDate(JsonField.of(debitDate)) - @JsonProperty("gross_pay") - @ExcludeMissing - fun grossPay(grossPay: JsonField) = apply { - this.grossPay = grossPay + fun debitDate(debitDate: JsonField) = apply { + this.debitDate = debitDate } - fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) + fun employeeTaxes(employeeTaxes: Boolean) = + employeeTaxes(JsonField.of(employeeTaxes)) - @JsonProperty("net_pay") - @ExcludeMissing - fun netPay(netPay: JsonField) = apply { this.netPay = netPay } + fun employeeTaxes(employeeTaxes: JsonField) = apply { + this.employeeTaxes = employeeTaxes + } fun employerTaxes(employerTaxes: Boolean) = employerTaxes(JsonField.of(employerTaxes)) - @JsonProperty("employer_taxes") - @ExcludeMissing fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes } - fun employeeTaxes(employeeTaxes: Boolean) = - employeeTaxes(JsonField.of(employeeTaxes)) + fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) - @JsonProperty("employee_taxes") - @ExcludeMissing - fun employeeTaxes(employeeTaxes: JsonField) = apply { - this.employeeTaxes = employeeTaxes + fun grossPay(grossPay: JsonField) = apply { + this.grossPay = grossPay } fun individualIds(individualIds: Boolean) = individualIds(JsonField.of(individualIds)) - @JsonProperty("individual_ids") - @ExcludeMissing fun individualIds(individualIds: JsonField) = apply { this.individualIds = individualIds } - fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) + fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) - @JsonProperty("pay_period") - @ExcludeMissing - fun payPeriod(payPeriod: JsonField) = apply { - this.payPeriod = payPeriod + fun netPay(netPay: JsonField) = apply { this.netPay = netPay } + + fun payDate(payDate: Boolean) = payDate(JsonField.of(payDate)) + + fun payDate(payDate: JsonField) = apply { this.payDate = payDate } + + fun payFrequencies(payFrequencies: Boolean) = + payFrequencies(JsonField.of(payFrequencies)) + + fun payFrequencies(payFrequencies: JsonField) = apply { + this.payFrequencies = payFrequencies } fun payGroupIds(payGroupIds: Boolean) = payGroupIds(JsonField.of(payGroupIds)) - @JsonProperty("pay_group_ids") - @ExcludeMissing fun payGroupIds(payGroupIds: JsonField) = apply { this.payGroupIds = payGroupIds } - fun payFrequencies(payFrequencies: Boolean) = - payFrequencies(JsonField.of(payFrequencies)) + fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) - @JsonProperty("pay_frequencies") - @ExcludeMissing - fun payFrequencies(payFrequencies: JsonField) = apply { - this.payFrequencies = payFrequencies + fun payPeriod(payPeriod: JsonField) = apply { + this.payPeriod = payPeriod } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedPaymentFields = SupportedPaymentFields( id, - payDate, - debitDate, companyDebit, - grossPay, - netPay, - employerTaxes, + debitDate, employeeTaxes, + employerTaxes, + grossPay, individualIds, - payPeriod, - payGroupIds, + netPay, + payDate, payFrequencies, + payGroupIds, + payPeriod, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = PayPeriod.Builder::class) @NoAutoDetect class PayPeriod + @JsonCreator private constructor( - private val startDate: JsonField, - private val endDate: JsonField, - private val additionalProperties: Map, + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayPeriod = apply { if (!validated) { - startDate() endDate() + startDate() validated = true } } @@ -5241,53 +5545,56 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payPeriod: PayPeriod) = apply { - this.startDate = payPeriod.startDate - this.endDate = payPeriod.endDate - additionalProperties(payPeriod.additionalProperties) - } - - fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) - - @JsonProperty("start_date") - @ExcludeMissing - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate + endDate = payPeriod.endDate + startDate = payPeriod.startDate + additionalProperties = payPeriod.additionalProperties.toMutableMap() } fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) - @JsonProperty("end_date") - @ExcludeMissing fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayPeriod = PayPeriod( - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -5297,17 +5604,17 @@ private constructor( return true } - return /* spotless:off */ other is PayPeriod && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayPeriod && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayPeriod{startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "PayPeriod{endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5315,17 +5622,17 @@ private constructor( return true } - return /* spotless:off */ other is SupportedPaymentFields && id == other.id && payDate == other.payDate && debitDate == other.debitDate && companyDebit == other.companyDebit && grossPay == other.grossPay && netPay == other.netPay && employerTaxes == other.employerTaxes && employeeTaxes == other.employeeTaxes && individualIds == other.individualIds && payPeriod == other.payPeriod && payGroupIds == other.payGroupIds && payFrequencies == other.payFrequencies && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedPaymentFields && id == other.id && companyDebit == other.companyDebit && debitDate == other.debitDate && employeeTaxes == other.employeeTaxes && employerTaxes == other.employerTaxes && grossPay == other.grossPay && individualIds == other.individualIds && netPay == other.netPay && payDate == other.payDate && payFrequencies == other.payFrequencies && payGroupIds == other.payGroupIds && payPeriod == other.payPeriod && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, payDate, debitDate, companyDebit, grossPay, netPay, employerTaxes, employeeTaxes, individualIds, payPeriod, payGroupIds, payFrequencies, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, companyDebit, debitDate, employeeTaxes, employerTaxes, grossPay, individualIds, netPay, payDate, payFrequencies, payGroupIds, payPeriod, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedPaymentFields{id=$id, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payPeriod=$payPeriod, payGroupIds=$payGroupIds, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" + "SupportedPaymentFields{id=$id, companyDebit=$companyDebit, debitDate=$debitDate, employeeTaxes=$employeeTaxes, employerTaxes=$employerTaxes, grossPay=$grossPay, individualIds=$individualIds, netPay=$netPay, payDate=$payDate, payFrequencies=$payFrequencies, payGroupIds=$payGroupIds, payPeriod=$payPeriod, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5333,17 +5640,17 @@ private constructor( return true } - return /* spotless:off */ other is SupportedFields && company == other.company && directory == other.directory && individual == other.individual && employment == other.employment && payment == other.payment && payStatement == other.payStatement && payGroup == other.payGroup && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedFields && company == other.company && directory == other.directory && employment == other.employment && individual == other.individual && payGroup == other.payGroup && payStatement == other.payStatement && payment == other.payment && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(company, directory, individual, employment, payment, payStatement, payGroup, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(company, directory, employment, individual, payGroup, payStatement, payment, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedFields{company=$company, directory=$directory, individual=$individual, employment=$employment, payment=$payment, payStatement=$payStatement, payGroup=$payGroup, additionalProperties=$additionalProperties}" + "SupportedFields{company=$company, directory=$directory, employment=$employment, individual=$individual, payGroup=$payGroup, payStatement=$payStatement, payment=$payment, additionalProperties=$additionalProperties}" } class Type @@ -5426,17 +5733,17 @@ private constructor( return true } - return /* spotless:off */ other is AuthenticationMethod && type == other.type && benefitsSupport == other.benefitsSupport && supportedFields == other.supportedFields && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AuthenticationMethod && benefitsSupport == other.benefitsSupport && supportedFields == other.supportedFields && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, benefitsSupport, supportedFields, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(benefitsSupport, supportedFields, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AuthenticationMethod{type=$type, benefitsSupport=$benefitsSupport, supportedFields=$supportedFields, additionalProperties=$additionalProperties}" + "AuthenticationMethod{benefitsSupport=$benefitsSupport, supportedFields=$supportedFields, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5444,17 +5751,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && status == other.status && authenticationMethod == other.authenticationMethod && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && authenticationMethod == other.authenticationMethod && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(status, authenticationMethod, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(authenticationMethod, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{status=$status, authenticationMethod=$authenticationMethod, additionalProperties=$additionalProperties}" + "Data{authenticationMethod=$authenticationMethod, status=$status, additionalProperties=$additionalProperties}" } class EventType @@ -5513,15 +5820,15 @@ private constructor( return true } - return /* spotless:off */ other is AccountUpdateEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountUpdateEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountUpdateEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "AccountUpdateEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index f3003216..c8b5162a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -6,37 +6,43 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = AccountUpdateResponse.Builder::class) @NoAutoDetect class AccountUpdateResponse +@JsonCreator private constructor( - private val connectionId: JsonField, - private val accountId: JsonField, - private val authenticationType: JsonField, - private val companyId: JsonField, - private val providerId: JsonField, - private val products: JsonField>, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + private val authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + private val providerId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The ID of the new connection */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun accountId(): String = accountId.getRequired("account_id") @@ -46,13 +52,14 @@ private constructor( /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun companyId(): String = companyId.getRequired("company_id") + fun products(): List = products.getRequired("products") + /** The ID of the provider associated with the `access_token` */ fun providerId(): String = providerId.getRequired("provider_id") - fun products(): List = products.getRequired("products") - /** The ID of the new connection */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId @@ -64,23 +71,28 @@ private constructor( /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("products") @ExcludeMissing fun _products() = products + /** The ID of the provider associated with the `access_token` */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId - @JsonProperty("products") @ExcludeMissing fun _products() = products + /** The ID of the new connection */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AccountUpdateResponse = apply { if (!validated) { - connectionId() accountId() authenticationType() companyId() - providerId() products() + providerId() + connectionId() validated = true } } @@ -94,48 +106,34 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() 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 providerId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountUpdateResponse: AccountUpdateResponse) = apply { - this.connectionId = accountUpdateResponse.connectionId - this.accountId = accountUpdateResponse.accountId - this.authenticationType = accountUpdateResponse.authenticationType - this.companyId = accountUpdateResponse.companyId - this.providerId = accountUpdateResponse.providerId - this.products = accountUpdateResponse.products - additionalProperties(accountUpdateResponse.additionalProperties) - } - - /** The ID of the new connection */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** The ID of the new connection */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = accountUpdateResponse.accountId + authenticationType = accountUpdateResponse.authenticationType + companyId = accountUpdateResponse.companyId + products = accountUpdateResponse.products + providerId = accountUpdateResponse.providerId + connectionId = accountUpdateResponse.connectionId + additionalProperties = accountUpdateResponse.additionalProperties.toMutableMap() } /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @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 } @@ -144,46 +142,53 @@ private constructor( fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @JsonProperty("company_id") - @ExcludeMissing fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun products(products: List) = products(JsonField.of(products)) + + fun products(products: JsonField>) = apply { this.products = products } + /** The ID of the provider associated with the `access_token` */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) /** The ID of the provider associated with the `access_token` */ - @JsonProperty("provider_id") - @ExcludeMissing fun providerId(providerId: JsonField) = apply { this.providerId = providerId } - fun products(products: List) = products(JsonField.of(products)) + /** The ID of the new connection */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("products") - @ExcludeMissing - fun products(products: JsonField>) = apply { this.products = products } + /** The ID of the new connection */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AccountUpdateResponse = AccountUpdateResponse( - connectionId, accountId, authenticationType, companyId, - providerId, products.map { it.toImmutable() }, + providerId, + connectionId, additionalProperties.toImmutable(), ) } @@ -262,15 +267,15 @@ private constructor( return true } - return /* spotless:off */ other is AccountUpdateResponse && connectionId == other.connectionId && accountId == other.accountId && authenticationType == other.authenticationType && companyId == other.companyId && providerId == other.providerId && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AccountUpdateResponse && accountId == other.accountId && authenticationType == other.authenticationType && companyId == other.companyId && products == other.products && providerId == other.providerId && connectionId == other.connectionId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, accountId, authenticationType, companyId, providerId, products, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, authenticationType, companyId, products, providerId, connectionId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AccountUpdateResponse{connectionId=$connectionId, accountId=$accountId, authenticationType=$authenticationType, companyId=$companyId, providerId=$providerId, products=$products, additionalProperties=$additionalProperties}" + "AccountUpdateResponse{accountId=$accountId, authenticationType=$authenticationType, companyId=$companyId, products=$products, providerId=$providerId, connectionId=$connectionId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 384f7e45..73d86867 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -6,46 +6,49 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = AutomatedAsyncJob.Builder::class) @NoAutoDetect class AutomatedAsyncJob +@JsonCreator private constructor( - private val jobId: JsonField, - private val jobUrl: JsonField, - private val type: JsonField, - private val status: JsonField, - private val createdAt: JsonField, - private val scheduledAt: JsonField, - private val startedAt: JsonField, - private val completedAt: JsonField, - private val additionalProperties: Map, + @JsonProperty("completed_at") + @ExcludeMissing + private val completedAt: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + private val createdAt: JsonField = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") + @ExcludeMissing + private val jobUrl: JsonField = JsonMissing.of(), + @JsonProperty("scheduled_at") + @ExcludeMissing + private val scheduledAt: JsonField = JsonMissing.of(), + @JsonProperty("started_at") + @ExcludeMissing + private val startedAt: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The id of the job that has been created. */ - fun jobId(): String = jobId.getRequired("job_id") - - /** The url that can be used to retrieve the job status */ - fun jobUrl(): String = jobUrl.getRequired("job_url") - - /** Only `data_sync_all` currently supported */ - fun type(): Type = type.getRequired("type") - - fun status(): Status = status.getRequired("status") + /** The datetime the job completed. */ + fun completedAt(): Optional = + Optional.ofNullable(completedAt.getNullable("completed_at")) /** * The datetime when the job was created. for scheduled jobs, this will be the initial @@ -53,6 +56,12 @@ private constructor( */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** The id of the job that has been created. */ + fun jobId(): String = jobId.getRequired("job_id") + + /** The url that can be used to retrieve the job status */ + fun jobUrl(): String = jobUrl.getRequired("job_url") + /** * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the * future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null. @@ -64,20 +73,13 @@ private constructor( fun startedAt(): Optional = Optional.ofNullable(startedAt.getNullable("started_at")) - /** The datetime the job completed. */ - fun completedAt(): Optional = - Optional.ofNullable(completedAt.getNullable("completed_at")) - - /** The id of the job that has been created. */ - @JsonProperty("job_id") @ExcludeMissing fun _jobId() = jobId - - /** The url that can be used to retrieve the job status */ - @JsonProperty("job_url") @ExcludeMissing fun _jobUrl() = jobUrl + fun status(): Status = status.getRequired("status") /** Only `data_sync_all` currently supported */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Type = type.getRequired("type") - @JsonProperty("status") @ExcludeMissing fun _status() = status + /** The datetime the job completed. */ + @JsonProperty("completed_at") @ExcludeMissing fun _completedAt() = completedAt /** * The datetime when the job was created. for scheduled jobs, this will be the initial @@ -85,6 +87,12 @@ private constructor( */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt + /** The id of the job that has been created. */ + @JsonProperty("job_id") @ExcludeMissing fun _jobId() = jobId + + /** The url that can be used to retrieve the job status */ + @JsonProperty("job_url") @ExcludeMissing fun _jobUrl() = jobUrl + /** * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the * future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null. @@ -94,23 +102,27 @@ private constructor( /** The datetime a job entered into the job queue. */ @JsonProperty("started_at") @ExcludeMissing fun _startedAt() = startedAt - /** The datetime the job completed. */ - @JsonProperty("completed_at") @ExcludeMissing fun _completedAt() = completedAt + @JsonProperty("status") @ExcludeMissing fun _status() = status + + /** Only `data_sync_all` currently supported */ + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AutomatedAsyncJob = apply { if (!validated) { + completedAt() + createdAt() jobId() jobUrl() - type() - status() - createdAt() scheduledAt() startedAt() - completedAt() + status() + type() validated = true } } @@ -124,58 +136,36 @@ private constructor( class Builder { + private var completedAt: JsonField = JsonMissing.of() + private var createdAt: JsonField = JsonMissing.of() private var jobId: JsonField = JsonMissing.of() private var jobUrl: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var status: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() private var scheduledAt: JsonField = JsonMissing.of() private var startedAt: JsonField = JsonMissing.of() - private var completedAt: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(automatedAsyncJob: AutomatedAsyncJob) = apply { - this.jobId = automatedAsyncJob.jobId - this.jobUrl = automatedAsyncJob.jobUrl - this.type = automatedAsyncJob.type - this.status = automatedAsyncJob.status - this.createdAt = automatedAsyncJob.createdAt - this.scheduledAt = automatedAsyncJob.scheduledAt - this.startedAt = automatedAsyncJob.startedAt - this.completedAt = automatedAsyncJob.completedAt - additionalProperties(automatedAsyncJob.additionalProperties) + completedAt = automatedAsyncJob.completedAt + createdAt = automatedAsyncJob.createdAt + jobId = automatedAsyncJob.jobId + jobUrl = automatedAsyncJob.jobUrl + scheduledAt = automatedAsyncJob.scheduledAt + startedAt = automatedAsyncJob.startedAt + status = automatedAsyncJob.status + type = automatedAsyncJob.type + additionalProperties = automatedAsyncJob.additionalProperties.toMutableMap() } - /** The id of the job that has been created. */ - fun jobId(jobId: String) = jobId(JsonField.of(jobId)) - - /** The id of the job that has been created. */ - @JsonProperty("job_id") - @ExcludeMissing - fun jobId(jobId: JsonField) = apply { this.jobId = jobId } - - /** The url that can be used to retrieve the job status */ - fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) - - /** The url that can be used to retrieve the job status */ - @JsonProperty("job_url") - @ExcludeMissing - fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } - - /** Only `data_sync_all` currently supported */ - fun type(type: Type) = type(JsonField.of(type)) - - /** Only `data_sync_all` currently supported */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun status(status: Status) = status(JsonField.of(status)) + /** The datetime the job completed. */ + fun completedAt(completedAt: OffsetDateTime) = completedAt(JsonField.of(completedAt)) - @JsonProperty("status") - @ExcludeMissing - fun status(status: JsonField) = apply { this.status = status } + /** The datetime the job completed. */ + fun completedAt(completedAt: JsonField) = apply { + this.completedAt = completedAt + } /** * The datetime when the job was created. for scheduled jobs, this will be the initial @@ -189,10 +179,20 @@ private constructor( * connection time. For ad-hoc jobs, this will be the time the creation request was * received. */ - @JsonProperty("created_at") - @ExcludeMissing fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + /** The id of the job that has been created. */ + fun jobId(jobId: String) = jobId(JsonField.of(jobId)) + + /** The id of the job that has been created. */ + fun jobId(jobId: JsonField) = apply { this.jobId = jobId } + + /** The url that can be used to retrieve the job status */ + fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) + + /** The url that can be used to retrieve the job status */ + fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } + /** * The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in * the future if the job has not yet been enqueued. For ad-hoc jobs, this field will @@ -205,8 +205,6 @@ private constructor( * the future if the job has not yet been enqueued. For ad-hoc jobs, this field will * be null. */ - @JsonProperty("scheduled_at") - @ExcludeMissing fun scheduledAt(scheduledAt: JsonField) = apply { this.scheduledAt = scheduledAt } @@ -215,44 +213,47 @@ private constructor( fun startedAt(startedAt: OffsetDateTime) = startedAt(JsonField.of(startedAt)) /** The datetime a job entered into the job queue. */ - @JsonProperty("started_at") - @ExcludeMissing fun startedAt(startedAt: JsonField) = apply { this.startedAt = startedAt } - /** The datetime the job completed. */ - fun completedAt(completedAt: OffsetDateTime) = completedAt(JsonField.of(completedAt)) + fun status(status: Status) = status(JsonField.of(status)) - /** The datetime the job completed. */ - @JsonProperty("completed_at") - @ExcludeMissing - fun completedAt(completedAt: JsonField) = apply { - this.completedAt = completedAt - } + fun status(status: JsonField) = apply { this.status = status } + + /** Only `data_sync_all` currently supported */ + fun type(type: Type) = type(JsonField.of(type)) + + /** Only `data_sync_all` currently supported */ + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AutomatedAsyncJob = AutomatedAsyncJob( + completedAt, + createdAt, jobId, jobUrl, - type, - status, - createdAt, scheduledAt, startedAt, - completedAt, + status, + type, additionalProperties.toImmutable(), ) } @@ -394,15 +395,15 @@ private constructor( return true } - return /* spotless:off */ other is AutomatedAsyncJob && jobId == other.jobId && jobUrl == other.jobUrl && type == other.type && status == other.status && createdAt == other.createdAt && scheduledAt == other.scheduledAt && startedAt == other.startedAt && completedAt == other.completedAt && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AutomatedAsyncJob && completedAt == other.completedAt && createdAt == other.createdAt && jobId == other.jobId && jobUrl == other.jobUrl && scheduledAt == other.scheduledAt && startedAt == other.startedAt && status == other.status && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(jobId, jobUrl, type, status, createdAt, scheduledAt, startedAt, completedAt, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(completedAt, createdAt, jobId, jobUrl, scheduledAt, startedAt, status, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AutomatedAsyncJob{jobId=$jobId, jobUrl=$jobUrl, type=$type, status=$status, createdAt=$createdAt, scheduledAt=$scheduledAt, startedAt=$startedAt, completedAt=$completedAt, additionalProperties=$additionalProperties}" + "AutomatedAsyncJob{completedAt=$completedAt, createdAt=$createdAt, jobId=$jobId, jobUrl=$jobUrl, scheduledAt=$scheduledAt, startedAt=$startedAt, status=$status, type=$type, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt index e4409676..089deb06 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt @@ -4,28 +4,36 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = AutomatedCreateResponse.Builder::class) @NoAutoDetect class AutomatedCreateResponse +@JsonCreator private constructor( - private val jobId: JsonField, - private val jobUrl: JsonField, - private val allowedRefreshes: JsonField, - private val remainingRefreshes: JsonField, - private val additionalProperties: Map, + @JsonProperty("allowed_refreshes") + @ExcludeMissing + private val allowedRefreshes: JsonField = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") + @ExcludeMissing + private val jobUrl: JsonField = JsonMissing.of(), + @JsonProperty("remaining_refreshes") + @ExcludeMissing + private val remainingRefreshes: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The number of allowed refreshes per hour (per hour, fixed window) */ + fun allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes") /** The id of the job that has been created. */ fun jobId(): String = jobId.getRequired("job_id") @@ -33,21 +41,18 @@ private constructor( /** The url that can be used to retrieve the job status */ fun jobUrl(): String = jobUrl.getRequired("job_url") - /** The number of allowed refreshes per hour (per hour, fixed window) */ - fun allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes") - /** The number of remaining refreshes available (per hour, fixed window) */ fun remainingRefreshes(): Long = remainingRefreshes.getRequired("remaining_refreshes") + /** The number of allowed refreshes per hour (per hour, fixed window) */ + @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes() = allowedRefreshes + /** The id of the job that has been created. */ @JsonProperty("job_id") @ExcludeMissing fun _jobId() = jobId /** The url that can be used to retrieve the job status */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl() = jobUrl - /** The number of allowed refreshes per hour (per hour, fixed window) */ - @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes() = allowedRefreshes - /** The number of remaining refreshes available (per hour, fixed window) */ @JsonProperty("remaining_refreshes") @ExcludeMissing @@ -57,11 +62,13 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AutomatedCreateResponse = apply { if (!validated) { + allowedRefreshes() jobId() jobUrl() - allowedRefreshes() remainingRefreshes() validated = true } @@ -76,78 +83,75 @@ private constructor( class Builder { + private var allowedRefreshes: JsonField = JsonMissing.of() private var jobId: JsonField = JsonMissing.of() private var jobUrl: JsonField = JsonMissing.of() - private var allowedRefreshes: JsonField = JsonMissing.of() private var remainingRefreshes: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(automatedCreateResponse: AutomatedCreateResponse) = apply { - this.jobId = automatedCreateResponse.jobId - this.jobUrl = automatedCreateResponse.jobUrl - this.allowedRefreshes = automatedCreateResponse.allowedRefreshes - this.remainingRefreshes = automatedCreateResponse.remainingRefreshes - additionalProperties(automatedCreateResponse.additionalProperties) + allowedRefreshes = automatedCreateResponse.allowedRefreshes + jobId = automatedCreateResponse.jobId + jobUrl = automatedCreateResponse.jobUrl + remainingRefreshes = automatedCreateResponse.remainingRefreshes + additionalProperties = automatedCreateResponse.additionalProperties.toMutableMap() + } + + /** The number of allowed refreshes per hour (per hour, fixed window) */ + fun allowedRefreshes(allowedRefreshes: Long) = + allowedRefreshes(JsonField.of(allowedRefreshes)) + + /** The number of allowed refreshes per hour (per hour, fixed window) */ + fun allowedRefreshes(allowedRefreshes: JsonField) = apply { + this.allowedRefreshes = allowedRefreshes } /** The id of the job that has been created. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) /** The id of the job that has been created. */ - @JsonProperty("job_id") - @ExcludeMissing fun jobId(jobId: JsonField) = apply { this.jobId = jobId } /** The url that can be used to retrieve the job status */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) /** The url that can be used to retrieve the job status */ - @JsonProperty("job_url") - @ExcludeMissing fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } - /** The number of allowed refreshes per hour (per hour, fixed window) */ - fun allowedRefreshes(allowedRefreshes: Long) = - allowedRefreshes(JsonField.of(allowedRefreshes)) - - /** The number of allowed refreshes per hour (per hour, fixed window) */ - @JsonProperty("allowed_refreshes") - @ExcludeMissing - fun allowedRefreshes(allowedRefreshes: JsonField) = apply { - this.allowedRefreshes = allowedRefreshes - } - /** The number of remaining refreshes available (per hour, fixed window) */ fun remainingRefreshes(remainingRefreshes: Long) = remainingRefreshes(JsonField.of(remainingRefreshes)) /** The number of remaining refreshes available (per hour, fixed window) */ - @JsonProperty("remaining_refreshes") - @ExcludeMissing fun remainingRefreshes(remainingRefreshes: JsonField) = apply { this.remainingRefreshes = remainingRefreshes } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AutomatedCreateResponse = AutomatedCreateResponse( + allowedRefreshes, jobId, jobUrl, - allowedRefreshes, remainingRefreshes, additionalProperties.toImmutable(), ) @@ -158,15 +162,15 @@ private constructor( return true } - return /* spotless:off */ other is AutomatedCreateResponse && jobId == other.jobId && jobUrl == other.jobUrl && allowedRefreshes == other.allowedRefreshes && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AutomatedCreateResponse && allowedRefreshes == other.allowedRefreshes && jobId == other.jobId && jobUrl == other.jobUrl && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(jobId, jobUrl, allowedRefreshes, remainingRefreshes, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowedRefreshes, jobId, jobUrl, remainingRefreshes, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AutomatedCreateResponse{jobId=$jobId, jobUrl=$jobUrl, allowedRefreshes=$allowedRefreshes, remainingRefreshes=$remainingRefreshes, additionalProperties=$additionalProperties}" + "AutomatedCreateResponse{allowedRefreshes=$allowedRefreshes, jobId=$jobId, jobUrl=$jobUrl, remainingRefreshes=$remainingRefreshes, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt index 58eb9c67..8fc57748 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BaseWebhookEvent.kt @@ -4,32 +4,39 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = BaseWebhookEvent.Builder::class) @NoAutoDetect class BaseWebhookEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) + /** + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * `connection_id` instead to identify the connection associated with this event. + */ + fun accountId(): String = accountId.getRequired("account_id") /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use @@ -37,14 +44,15 @@ private constructor( */ fun companyId(): String = companyId.getRequired("company_id") + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) + /** * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use @@ -52,21 +60,20 @@ private constructor( */ @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use - * `connection_id` instead to identify the connection associated with this event. - */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): BaseWebhookEvent = apply { if (!validated) { - connectionId() - companyId() accountId() + companyId() + connectionId() validated = true } } @@ -80,76 +87,75 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(baseWebhookEvent: BaseWebhookEvent) = apply { - this.connectionId = baseWebhookEvent.connectionId - this.companyId = baseWebhookEvent.companyId - this.accountId = baseWebhookEvent.accountId - additionalProperties(baseWebhookEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = baseWebhookEvent.accountId + companyId = baseWebhookEvent.companyId + connectionId = baseWebhookEvent.connectionId + additionalProperties = baseWebhookEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): BaseWebhookEvent = BaseWebhookEvent( - connectionId, - companyId, accountId, + companyId, + connectionId, additionalProperties.toImmutable(), ) } @@ -159,15 +165,15 @@ private constructor( return true } - return /* spotless:off */ other is BaseWebhookEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BaseWebhookEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BaseWebhookEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, additionalProperties=$additionalProperties}" + "BaseWebhookEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt index 7bdc455e..2fa66770 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt @@ -6,49 +6,49 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = BenefitContribution.Builder::class) @NoAutoDetect class BenefitContribution +@JsonCreator private constructor( - private val type: JsonField, - private val amount: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ + fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) /** Contribution type. */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** Contribution type. */ @JsonProperty("type") @ExcludeMissing fun _type() = type - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): BenefitContribution = apply { if (!validated) { - type() amount() + type() validated = true } } @@ -62,51 +62,52 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(benefitContribution: BenefitContribution) = apply { - this.type = benefitContribution.type - this.amount = benefitContribution.amount - additionalProperties(benefitContribution.additionalProperties) + amount = benefitContribution.amount + type = benefitContribution.type + additionalProperties = benefitContribution.additionalProperties.toMutableMap() } - /** Contribution type. */ - fun type(type: Type) = type(JsonField.of(type)) - - /** Contribution type. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** Contribution amount in cents (if `fixed`) or basis points (if `percent`). */ - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } + /** Contribution type. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** Contribution type. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): BenefitContribution = BenefitContribution( - type, amount, + type, additionalProperties.toImmutable(), ) } @@ -173,15 +174,15 @@ private constructor( return true } - return /* spotless:off */ other is BenefitContribution && type == other.type && amount == other.amount && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BenefitContribution && amount == other.amount && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, amount, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BenefitContribution{type=$type, amount=$amount, additionalProperties=$additionalProperties}" + "BenefitContribution{amount=$amount, type=$type, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 7a05587b..9f4489fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -6,29 +6,31 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = BenefitFeaturesAndOperations.Builder::class) @NoAutoDetect class BenefitFeaturesAndOperations +@JsonCreator private constructor( - private val supportedFeatures: JsonField, - private val supportedOperations: JsonField, - private val additionalProperties: Map, + @JsonProperty("supported_features") + @ExcludeMissing + private val supportedFeatures: JsonField = JsonMissing.of(), + @JsonProperty("supported_operations") + @ExcludeMissing + private val supportedOperations: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun supportedFeatures(): Optional = Optional.ofNullable(supportedFeatures.getNullable("supported_features")) @@ -45,6 +47,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): BenefitFeaturesAndOperations = apply { if (!validated) { supportedFeatures().map { it.validate() } @@ -68,16 +72,14 @@ private constructor( @JvmSynthetic internal fun from(benefitFeaturesAndOperations: BenefitFeaturesAndOperations) = apply { - this.supportedFeatures = benefitFeaturesAndOperations.supportedFeatures - this.supportedOperations = benefitFeaturesAndOperations.supportedOperations - additionalProperties(benefitFeaturesAndOperations.additionalProperties) + supportedFeatures = benefitFeaturesAndOperations.supportedFeatures + supportedOperations = benefitFeaturesAndOperations.supportedOperations + additionalProperties = benefitFeaturesAndOperations.additionalProperties.toMutableMap() } fun supportedFeatures(supportedFeatures: BenefitFeature) = supportedFeatures(JsonField.of(supportedFeatures)) - @JsonProperty("supported_features") - @ExcludeMissing fun supportedFeatures(supportedFeatures: JsonField) = apply { this.supportedFeatures = supportedFeatures } @@ -85,26 +87,29 @@ private constructor( fun supportedOperations(supportedOperations: SupportPerBenefitType) = supportedOperations(JsonField.of(supportedOperations)) - @JsonProperty("supported_operations") - @ExcludeMissing fun supportedOperations(supportedOperations: JsonField) = apply { this.supportedOperations = supportedOperations } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): BenefitFeaturesAndOperations = BenefitFeaturesAndOperations( supportedFeatures, @@ -113,81 +118,94 @@ private constructor( ) } - @JsonDeserialize(builder = BenefitFeature.Builder::class) @NoAutoDetect class BenefitFeature + @JsonCreator private constructor( - private val description: JsonField, - private val frequencies: JsonField>, - private val employeeDeduction: JsonField>, - private val companyContribution: JsonField>, - private val annualMaximum: JsonField, - private val catchUp: JsonField, - private val hsaContributionLimit: JsonField>, - private val additionalProperties: Map, + @JsonProperty("annual_maximum") + @ExcludeMissing + private val annualMaximum: JsonField = JsonMissing.of(), + @JsonProperty("catch_up") + @ExcludeMissing + private val catchUp: JsonField = JsonMissing.of(), + @JsonProperty("company_contribution") + @ExcludeMissing + private val companyContribution: JsonField> = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("employee_deduction") + @ExcludeMissing + private val employeeDeduction: JsonField> = JsonMissing.of(), + @JsonProperty("frequencies") + @ExcludeMissing + private val frequencies: JsonField> = JsonMissing.of(), + @JsonProperty("hsa_contribution_limit") + @ExcludeMissing + private val hsaContributionLimit: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** Whether the provider supports an annual maximum for this benefit. */ + fun annualMaximum(): Optional = + Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) + + /** + * Whether the provider supports catch up for this benefit. This field will only be true for + * retirement benefits. + */ + fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + + /** + * Supported contribution types. An empty array indicates contributions are not supported. + */ + fun companyContribution(): Optional> = + Optional.ofNullable(companyContribution.getNullable("company_contribution")) fun description(): Optional = Optional.ofNullable(description.getNullable("description")) - /** The list of frequencies supported by the provider for this benefit */ - fun frequencies(): Optional> = - Optional.ofNullable(frequencies.getNullable("frequencies")) - /** Supported deduction types. An empty array indicates deductions are not supported. */ fun employeeDeduction(): Optional> = Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) + /** The list of frequencies supported by the provider for this benefit */ + fun frequencies(): Optional> = + Optional.ofNullable(frequencies.getNullable("frequencies")) + /** - * Supported contribution types. An empty array indicates contributions are not supported. + * Whether the provider supports HSA contribution limits. Empty if this feature is not + * supported for the benefit. This array only has values for HSA benefits. */ - fun companyContribution(): Optional> = - Optional.ofNullable(companyContribution.getNullable("company_contribution")) + fun hsaContributionLimit(): Optional> = + Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) /** Whether the provider supports an annual maximum for this benefit. */ - fun annualMaximum(): Optional = - Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) + @JsonProperty("annual_maximum") @ExcludeMissing fun _annualMaximum() = annualMaximum /** * Whether the provider supports catch up for this benefit. This field will only be true for * retirement benefits. */ - fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + @JsonProperty("catch_up") @ExcludeMissing fun _catchUp() = catchUp /** - * Whether the provider supports HSA contribution limits. Empty if this feature is not - * supported for the benefit. This array only has values for HSA benefits. + * Supported contribution types. An empty array indicates contributions are not supported. */ - fun hsaContributionLimit(): Optional> = - Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) + @JsonProperty("company_contribution") + @ExcludeMissing + fun _companyContribution() = companyContribution @JsonProperty("description") @ExcludeMissing fun _description() = description - /** The list of frequencies supported by the provider for this benefit */ - @JsonProperty("frequencies") @ExcludeMissing fun _frequencies() = frequencies - /** Supported deduction types. An empty array indicates deductions are not supported. */ @JsonProperty("employee_deduction") @ExcludeMissing fun _employeeDeduction() = employeeDeduction - /** - * Supported contribution types. An empty array indicates contributions are not supported. - */ - @JsonProperty("company_contribution") - @ExcludeMissing - fun _companyContribution() = companyContribution - - /** Whether the provider supports an annual maximum for this benefit. */ - @JsonProperty("annual_maximum") @ExcludeMissing fun _annualMaximum() = annualMaximum - - /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. - */ - @JsonProperty("catch_up") @ExcludeMissing fun _catchUp() = catchUp + /** The list of frequencies supported by the provider for this benefit */ + @JsonProperty("frequencies") @ExcludeMissing fun _frequencies() = frequencies /** * Whether the provider supports HSA contribution limits. Empty if this feature is not @@ -201,14 +219,16 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): BenefitFeature = apply { if (!validated) { - description() - frequencies() - employeeDeduction() - companyContribution() annualMaximum() catchUp() + companyContribution() + description() + employeeDeduction() + frequencies() hsaContributionLimit() validated = true } @@ -223,58 +243,48 @@ private constructor( class Builder { - private var description: JsonField = JsonMissing.of() - private var frequencies: JsonField> = JsonMissing.of() - private var employeeDeduction: JsonField> = JsonMissing.of() - private var companyContribution: JsonField> = - JsonMissing.of() private var annualMaximum: JsonField = JsonMissing.of() private var catchUp: JsonField = JsonMissing.of() + private var companyContribution: JsonField> = + JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var employeeDeduction: JsonField> = JsonMissing.of() + private var frequencies: JsonField> = JsonMissing.of() private var hsaContributionLimit: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(benefitFeature: BenefitFeature) = apply { - this.description = benefitFeature.description - this.frequencies = benefitFeature.frequencies - this.employeeDeduction = benefitFeature.employeeDeduction - this.companyContribution = benefitFeature.companyContribution - this.annualMaximum = benefitFeature.annualMaximum - this.catchUp = benefitFeature.catchUp - this.hsaContributionLimit = benefitFeature.hsaContributionLimit - additionalProperties(benefitFeature.additionalProperties) - } - - fun description(description: String) = description(JsonField.of(description)) - - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { - this.description = description + annualMaximum = benefitFeature.annualMaximum + catchUp = benefitFeature.catchUp + companyContribution = benefitFeature.companyContribution + description = benefitFeature.description + employeeDeduction = benefitFeature.employeeDeduction + frequencies = benefitFeature.frequencies + hsaContributionLimit = benefitFeature.hsaContributionLimit + additionalProperties = benefitFeature.additionalProperties.toMutableMap() } - /** The list of frequencies supported by the provider for this benefit */ - fun frequencies(frequencies: List) = - frequencies(JsonField.of(frequencies)) + /** Whether the provider supports an annual maximum for this benefit. */ + fun annualMaximum(annualMaximum: Boolean) = annualMaximum(JsonField.of(annualMaximum)) - /** The list of frequencies supported by the provider for this benefit */ - @JsonProperty("frequencies") - @ExcludeMissing - fun frequencies(frequencies: JsonField>) = apply { - this.frequencies = frequencies + /** Whether the provider supports an annual maximum for this benefit. */ + fun annualMaximum(annualMaximum: JsonField) = apply { + this.annualMaximum = annualMaximum } - /** Supported deduction types. An empty array indicates deductions are not supported. */ - fun employeeDeduction(employeeDeduction: List) = - employeeDeduction(JsonField.of(employeeDeduction)) + /** + * Whether the provider supports catch up for this benefit. This field will only be true + * for retirement benefits. + */ + fun catchUp(catchUp: Boolean) = catchUp(JsonField.of(catchUp)) - /** Supported deduction types. An empty array indicates deductions are not supported. */ - @JsonProperty("employee_deduction") - @ExcludeMissing - fun employeeDeduction(employeeDeduction: JsonField>) = apply { - this.employeeDeduction = employeeDeduction - } + /** + * Whether the provider supports catch up for this benefit. This field will only be true + * for retirement benefits. + */ + fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp } /** * Supported contribution types. An empty array indicates contributions are not @@ -287,36 +297,34 @@ private constructor( * Supported contribution types. An empty array indicates contributions are not * supported. */ - @JsonProperty("company_contribution") - @ExcludeMissing fun companyContribution(companyContribution: JsonField>) = apply { this.companyContribution = companyContribution } - /** Whether the provider supports an annual maximum for this benefit. */ - fun annualMaximum(annualMaximum: Boolean) = annualMaximum(JsonField.of(annualMaximum)) + fun description(description: String) = description(JsonField.of(description)) - /** Whether the provider supports an annual maximum for this benefit. */ - @JsonProperty("annual_maximum") - @ExcludeMissing - fun annualMaximum(annualMaximum: JsonField) = apply { - this.annualMaximum = annualMaximum + fun description(description: JsonField) = apply { + this.description = description } - /** - * Whether the provider supports catch up for this benefit. This field will only be true - * for retirement benefits. - */ - fun catchUp(catchUp: Boolean) = catchUp(JsonField.of(catchUp)) + /** Supported deduction types. An empty array indicates deductions are not supported. */ + fun employeeDeduction(employeeDeduction: List) = + employeeDeduction(JsonField.of(employeeDeduction)) - /** - * Whether the provider supports catch up for this benefit. This field will only be true - * for retirement benefits. - */ - @JsonProperty("catch_up") - @ExcludeMissing - fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp } + /** Supported deduction types. An empty array indicates deductions are not supported. */ + fun employeeDeduction(employeeDeduction: JsonField>) = apply { + this.employeeDeduction = employeeDeduction + } + + /** The list of frequencies supported by the provider for this benefit */ + fun frequencies(frequencies: List) = + frequencies(JsonField.of(frequencies)) + + /** The list of frequencies supported by the provider for this benefit */ + fun frequencies(frequencies: JsonField>) = apply { + this.frequencies = frequencies + } /** * Whether the provider supports HSA contribution limits. Empty if this feature is not @@ -329,8 +337,6 @@ private constructor( * Whether the provider supports HSA contribution limits. Empty if this feature is not * supported for the benefit. This array only has values for HSA benefits. */ - @JsonProperty("hsa_contribution_limit") - @ExcludeMissing fun hsaContributionLimit(hsaContributionLimit: JsonField>) = apply { this.hsaContributionLimit = hsaContributionLimit @@ -338,26 +344,31 @@ private constructor( fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): BenefitFeature = BenefitFeature( - description, - frequencies.map { it.toImmutable() }, - employeeDeduction.map { it.toImmutable() }, - companyContribution.map { it.toImmutable() }, annualMaximum, catchUp, + companyContribution.map { it.toImmutable() }, + description, + employeeDeduction.map { it.toImmutable() }, + frequencies.map { it.toImmutable() }, hsaContributionLimit.map { it.toImmutable() }, additionalProperties.toImmutable(), ) @@ -539,17 +550,17 @@ private constructor( return true } - return /* spotless:off */ other is BenefitFeature && description == other.description && frequencies == other.frequencies && employeeDeduction == other.employeeDeduction && companyContribution == other.companyContribution && annualMaximum == other.annualMaximum && catchUp == other.catchUp && hsaContributionLimit == other.hsaContributionLimit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BenefitFeature && annualMaximum == other.annualMaximum && catchUp == other.catchUp && companyContribution == other.companyContribution && description == other.description && employeeDeduction == other.employeeDeduction && frequencies == other.frequencies && hsaContributionLimit == other.hsaContributionLimit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(description, frequencies, employeeDeduction, companyContribution, annualMaximum, catchUp, hsaContributionLimit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(annualMaximum, catchUp, companyContribution, description, employeeDeduction, frequencies, hsaContributionLimit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BenefitFeature{description=$description, frequencies=$frequencies, employeeDeduction=$employeeDeduction, companyContribution=$companyContribution, annualMaximum=$annualMaximum, catchUp=$catchUp, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}" + "BenefitFeature{annualMaximum=$annualMaximum, catchUp=$catchUp, companyContribution=$companyContribution, description=$description, employeeDeduction=$employeeDeduction, frequencies=$frequencies, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt index 2645c5d0..06e19af6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitsSupport.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional @@ -19,105 +20,129 @@ import java.util.Optional * Each benefit type and their supported features. If the benefit type is not supported, the * property will be null */ -@JsonDeserialize(builder = BenefitsSupport.Builder::class) @NoAutoDetect class BenefitsSupport +@JsonCreator private constructor( - private val s125Medical: JsonField, - private val s125Dental: JsonField, - private val s125Vision: JsonField, - private val hsaPre: JsonField, - private val hsaPost: JsonField, - private val fsaMedical: JsonField, - private val fsaDependentCare: JsonField, - private val simpleIra: JsonField, - private val simple: JsonField, - private val commuter: JsonField, - private val customPostTax: JsonField, - private val customPreTax: JsonField, - private val additionalProperties: Map, + @JsonProperty("commuter") + @ExcludeMissing + private val commuter: JsonField = JsonMissing.of(), + @JsonProperty("custom_post_tax") + @ExcludeMissing + private val customPostTax: JsonField = JsonMissing.of(), + @JsonProperty("custom_pre_tax") + @ExcludeMissing + private val customPreTax: JsonField = JsonMissing.of(), + @JsonProperty("fsa_dependent_care") + @ExcludeMissing + private val fsaDependentCare: JsonField = JsonMissing.of(), + @JsonProperty("fsa_medical") + @ExcludeMissing + private val fsaMedical: JsonField = JsonMissing.of(), + @JsonProperty("hsa_post") + @ExcludeMissing + private val hsaPost: JsonField = JsonMissing.of(), + @JsonProperty("hsa_pre") + @ExcludeMissing + private val hsaPre: JsonField = JsonMissing.of(), + @JsonProperty("s125_dental") + @ExcludeMissing + private val s125Dental: JsonField = JsonMissing.of(), + @JsonProperty("s125_medical") + @ExcludeMissing + private val s125Medical: JsonField = JsonMissing.of(), + @JsonProperty("s125_vision") + @ExcludeMissing + private val s125Vision: JsonField = JsonMissing.of(), + @JsonProperty("simple") + @ExcludeMissing + private val simple: JsonField = JsonMissing.of(), + @JsonProperty("simple_ira") + @ExcludeMissing + private val simpleIra: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun commuter(): Optional = + Optional.ofNullable(commuter.getNullable("commuter")) - fun s125Medical(): Optional = - Optional.ofNullable(s125Medical.getNullable("s125_medical")) + fun customPostTax(): Optional = + Optional.ofNullable(customPostTax.getNullable("custom_post_tax")) - fun s125Dental(): Optional = - Optional.ofNullable(s125Dental.getNullable("s125_dental")) + fun customPreTax(): Optional = + Optional.ofNullable(customPreTax.getNullable("custom_pre_tax")) - fun s125Vision(): Optional = - Optional.ofNullable(s125Vision.getNullable("s125_vision")) + fun fsaDependentCare(): Optional = + Optional.ofNullable(fsaDependentCare.getNullable("fsa_dependent_care")) - fun hsaPre(): Optional = - Optional.ofNullable(hsaPre.getNullable("hsa_pre")) + fun fsaMedical(): Optional = + Optional.ofNullable(fsaMedical.getNullable("fsa_medical")) fun hsaPost(): Optional = Optional.ofNullable(hsaPost.getNullable("hsa_post")) - fun fsaMedical(): Optional = - Optional.ofNullable(fsaMedical.getNullable("fsa_medical")) + fun hsaPre(): Optional = + Optional.ofNullable(hsaPre.getNullable("hsa_pre")) - fun fsaDependentCare(): Optional = - Optional.ofNullable(fsaDependentCare.getNullable("fsa_dependent_care")) + fun s125Dental(): Optional = + Optional.ofNullable(s125Dental.getNullable("s125_dental")) - fun simpleIra(): Optional = - Optional.ofNullable(simpleIra.getNullable("simple_ira")) + fun s125Medical(): Optional = + Optional.ofNullable(s125Medical.getNullable("s125_medical")) + + fun s125Vision(): Optional = + Optional.ofNullable(s125Vision.getNullable("s125_vision")) fun simple(): Optional = Optional.ofNullable(simple.getNullable("simple")) - fun commuter(): Optional = - Optional.ofNullable(commuter.getNullable("commuter")) - - fun customPostTax(): Optional = - Optional.ofNullable(customPostTax.getNullable("custom_post_tax")) + fun simpleIra(): Optional = + Optional.ofNullable(simpleIra.getNullable("simple_ira")) - fun customPreTax(): Optional = - Optional.ofNullable(customPreTax.getNullable("custom_pre_tax")) + @JsonProperty("commuter") @ExcludeMissing fun _commuter() = commuter - @JsonProperty("s125_medical") @ExcludeMissing fun _s125Medical() = s125Medical + @JsonProperty("custom_post_tax") @ExcludeMissing fun _customPostTax() = customPostTax - @JsonProperty("s125_dental") @ExcludeMissing fun _s125Dental() = s125Dental + @JsonProperty("custom_pre_tax") @ExcludeMissing fun _customPreTax() = customPreTax - @JsonProperty("s125_vision") @ExcludeMissing fun _s125Vision() = s125Vision + @JsonProperty("fsa_dependent_care") @ExcludeMissing fun _fsaDependentCare() = fsaDependentCare - @JsonProperty("hsa_pre") @ExcludeMissing fun _hsaPre() = hsaPre + @JsonProperty("fsa_medical") @ExcludeMissing fun _fsaMedical() = fsaMedical @JsonProperty("hsa_post") @ExcludeMissing fun _hsaPost() = hsaPost - @JsonProperty("fsa_medical") @ExcludeMissing fun _fsaMedical() = fsaMedical - - @JsonProperty("fsa_dependent_care") @ExcludeMissing fun _fsaDependentCare() = fsaDependentCare + @JsonProperty("hsa_pre") @ExcludeMissing fun _hsaPre() = hsaPre - @JsonProperty("simple_ira") @ExcludeMissing fun _simpleIra() = simpleIra + @JsonProperty("s125_dental") @ExcludeMissing fun _s125Dental() = s125Dental - @JsonProperty("simple") @ExcludeMissing fun _simple() = simple + @JsonProperty("s125_medical") @ExcludeMissing fun _s125Medical() = s125Medical - @JsonProperty("commuter") @ExcludeMissing fun _commuter() = commuter + @JsonProperty("s125_vision") @ExcludeMissing fun _s125Vision() = s125Vision - @JsonProperty("custom_post_tax") @ExcludeMissing fun _customPostTax() = customPostTax + @JsonProperty("simple") @ExcludeMissing fun _simple() = simple - @JsonProperty("custom_pre_tax") @ExcludeMissing fun _customPreTax() = customPreTax + @JsonProperty("simple_ira") @ExcludeMissing fun _simpleIra() = simpleIra @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): BenefitsSupport = apply { if (!validated) { - s125Medical().map { it.validate() } - s125Dental().map { it.validate() } - s125Vision().map { it.validate() } - hsaPre().map { it.validate() } - hsaPost().map { it.validate() } - fsaMedical().map { it.validate() } - fsaDependentCare().map { it.validate() } - simpleIra().map { it.validate() } - simple().map { it.validate() } commuter().map { it.validate() } customPostTax().map { it.validate() } customPreTax().map { it.validate() } + fsaDependentCare().map { it.validate() } + fsaMedical().map { it.validate() } + hsaPost().map { it.validate() } + hsaPre().map { it.validate() } + s125Dental().map { it.validate() } + s125Medical().map { it.validate() } + s125Vision().map { it.validate() } + simple().map { it.validate() } + simpleIra().map { it.validate() } validated = true } } @@ -131,164 +156,145 @@ private constructor( class Builder { - private var s125Medical: JsonField = JsonMissing.of() - private var s125Dental: JsonField = JsonMissing.of() - private var s125Vision: JsonField = JsonMissing.of() - private var hsaPre: JsonField = JsonMissing.of() - private var hsaPost: JsonField = JsonMissing.of() - private var fsaMedical: JsonField = JsonMissing.of() - private var fsaDependentCare: JsonField = JsonMissing.of() - private var simpleIra: JsonField = JsonMissing.of() - private var simple: JsonField = JsonMissing.of() private var commuter: JsonField = JsonMissing.of() private var customPostTax: JsonField = JsonMissing.of() private var customPreTax: JsonField = JsonMissing.of() + private var fsaDependentCare: JsonField = JsonMissing.of() + private var fsaMedical: JsonField = JsonMissing.of() + private var hsaPost: JsonField = JsonMissing.of() + private var hsaPre: JsonField = JsonMissing.of() + private var s125Dental: JsonField = JsonMissing.of() + private var s125Medical: JsonField = JsonMissing.of() + private var s125Vision: JsonField = JsonMissing.of() + private var simple: JsonField = JsonMissing.of() + private var simpleIra: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(benefitsSupport: BenefitsSupport) = apply { - this.s125Medical = benefitsSupport.s125Medical - this.s125Dental = benefitsSupport.s125Dental - this.s125Vision = benefitsSupport.s125Vision - this.hsaPre = benefitsSupport.hsaPre - this.hsaPost = benefitsSupport.hsaPost - this.fsaMedical = benefitsSupport.fsaMedical - this.fsaDependentCare = benefitsSupport.fsaDependentCare - this.simpleIra = benefitsSupport.simpleIra - this.simple = benefitsSupport.simple - this.commuter = benefitsSupport.commuter - this.customPostTax = benefitsSupport.customPostTax - this.customPreTax = benefitsSupport.customPreTax - additionalProperties(benefitsSupport.additionalProperties) + commuter = benefitsSupport.commuter + customPostTax = benefitsSupport.customPostTax + customPreTax = benefitsSupport.customPreTax + fsaDependentCare = benefitsSupport.fsaDependentCare + fsaMedical = benefitsSupport.fsaMedical + hsaPost = benefitsSupport.hsaPost + hsaPre = benefitsSupport.hsaPre + s125Dental = benefitsSupport.s125Dental + s125Medical = benefitsSupport.s125Medical + s125Vision = benefitsSupport.s125Vision + simple = benefitsSupport.simple + simpleIra = benefitsSupport.simpleIra + additionalProperties = benefitsSupport.additionalProperties.toMutableMap() } - fun s125Medical(s125Medical: BenefitFeaturesAndOperations) = - s125Medical(JsonField.of(s125Medical)) + fun commuter(commuter: BenefitFeaturesAndOperations) = commuter(JsonField.of(commuter)) - @JsonProperty("s125_medical") - @ExcludeMissing - fun s125Medical(s125Medical: JsonField) = apply { - this.s125Medical = s125Medical + fun commuter(commuter: JsonField) = apply { + this.commuter = commuter } - fun s125Dental(s125Dental: BenefitFeaturesAndOperations) = - s125Dental(JsonField.of(s125Dental)) + fun customPostTax(customPostTax: BenefitFeaturesAndOperations) = + customPostTax(JsonField.of(customPostTax)) - @JsonProperty("s125_dental") - @ExcludeMissing - fun s125Dental(s125Dental: JsonField) = apply { - this.s125Dental = s125Dental + fun customPostTax(customPostTax: JsonField) = apply { + this.customPostTax = customPostTax } - fun s125Vision(s125Vision: BenefitFeaturesAndOperations) = - s125Vision(JsonField.of(s125Vision)) + fun customPreTax(customPreTax: BenefitFeaturesAndOperations) = + customPreTax(JsonField.of(customPreTax)) - @JsonProperty("s125_vision") - @ExcludeMissing - fun s125Vision(s125Vision: JsonField) = apply { - this.s125Vision = s125Vision + fun customPreTax(customPreTax: JsonField) = apply { + this.customPreTax = customPreTax } - fun hsaPre(hsaPre: BenefitFeaturesAndOperations) = hsaPre(JsonField.of(hsaPre)) - - @JsonProperty("hsa_pre") - @ExcludeMissing - fun hsaPre(hsaPre: JsonField) = apply { this.hsaPre = hsaPre } - - fun hsaPost(hsaPost: BenefitFeaturesAndOperations) = hsaPost(JsonField.of(hsaPost)) + fun fsaDependentCare(fsaDependentCare: BenefitFeaturesAndOperations) = + fsaDependentCare(JsonField.of(fsaDependentCare)) - @JsonProperty("hsa_post") - @ExcludeMissing - fun hsaPost(hsaPost: JsonField) = apply { - this.hsaPost = hsaPost + fun fsaDependentCare(fsaDependentCare: JsonField) = apply { + this.fsaDependentCare = fsaDependentCare } fun fsaMedical(fsaMedical: BenefitFeaturesAndOperations) = fsaMedical(JsonField.of(fsaMedical)) - @JsonProperty("fsa_medical") - @ExcludeMissing fun fsaMedical(fsaMedical: JsonField) = apply { this.fsaMedical = fsaMedical } - fun fsaDependentCare(fsaDependentCare: BenefitFeaturesAndOperations) = - fsaDependentCare(JsonField.of(fsaDependentCare)) + fun hsaPost(hsaPost: BenefitFeaturesAndOperations) = hsaPost(JsonField.of(hsaPost)) - @JsonProperty("fsa_dependent_care") - @ExcludeMissing - fun fsaDependentCare(fsaDependentCare: JsonField) = apply { - this.fsaDependentCare = fsaDependentCare + fun hsaPost(hsaPost: JsonField) = apply { + this.hsaPost = hsaPost } - fun simpleIra(simpleIra: BenefitFeaturesAndOperations) = simpleIra(JsonField.of(simpleIra)) + fun hsaPre(hsaPre: BenefitFeaturesAndOperations) = hsaPre(JsonField.of(hsaPre)) - @JsonProperty("simple_ira") - @ExcludeMissing - fun simpleIra(simpleIra: JsonField) = apply { - this.simpleIra = simpleIra - } + fun hsaPre(hsaPre: JsonField) = apply { this.hsaPre = hsaPre } - fun simple(simple: BenefitFeaturesAndOperations) = simple(JsonField.of(simple)) + fun s125Dental(s125Dental: BenefitFeaturesAndOperations) = + s125Dental(JsonField.of(s125Dental)) - @JsonProperty("simple") - @ExcludeMissing - fun simple(simple: JsonField) = apply { this.simple = simple } + fun s125Dental(s125Dental: JsonField) = apply { + this.s125Dental = s125Dental + } - fun commuter(commuter: BenefitFeaturesAndOperations) = commuter(JsonField.of(commuter)) + fun s125Medical(s125Medical: BenefitFeaturesAndOperations) = + s125Medical(JsonField.of(s125Medical)) - @JsonProperty("commuter") - @ExcludeMissing - fun commuter(commuter: JsonField) = apply { - this.commuter = commuter + fun s125Medical(s125Medical: JsonField) = apply { + this.s125Medical = s125Medical } - fun customPostTax(customPostTax: BenefitFeaturesAndOperations) = - customPostTax(JsonField.of(customPostTax)) + fun s125Vision(s125Vision: BenefitFeaturesAndOperations) = + s125Vision(JsonField.of(s125Vision)) - @JsonProperty("custom_post_tax") - @ExcludeMissing - fun customPostTax(customPostTax: JsonField) = apply { - this.customPostTax = customPostTax + fun s125Vision(s125Vision: JsonField) = apply { + this.s125Vision = s125Vision } - fun customPreTax(customPreTax: BenefitFeaturesAndOperations) = - customPreTax(JsonField.of(customPreTax)) + fun simple(simple: BenefitFeaturesAndOperations) = simple(JsonField.of(simple)) - @JsonProperty("custom_pre_tax") - @ExcludeMissing - fun customPreTax(customPreTax: JsonField) = apply { - this.customPreTax = customPreTax + fun simple(simple: JsonField) = apply { this.simple = simple } + + fun simpleIra(simpleIra: BenefitFeaturesAndOperations) = simpleIra(JsonField.of(simpleIra)) + + fun simpleIra(simpleIra: JsonField) = apply { + this.simpleIra = simpleIra } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): BenefitsSupport = BenefitsSupport( - s125Medical, - s125Dental, - s125Vision, - hsaPre, - hsaPost, - fsaMedical, - fsaDependentCare, - simpleIra, - simple, commuter, customPostTax, customPreTax, + fsaDependentCare, + fsaMedical, + hsaPost, + hsaPre, + s125Dental, + s125Medical, + s125Vision, + simple, + simpleIra, additionalProperties.toImmutable(), ) } @@ -298,15 +304,15 @@ private constructor( return true } - return /* spotless:off */ other is BenefitsSupport && s125Medical == other.s125Medical && s125Dental == other.s125Dental && s125Vision == other.s125Vision && hsaPre == other.hsaPre && hsaPost == other.hsaPost && fsaMedical == other.fsaMedical && fsaDependentCare == other.fsaDependentCare && simpleIra == other.simpleIra && simple == other.simple && commuter == other.commuter && customPostTax == other.customPostTax && customPreTax == other.customPreTax && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is BenefitsSupport && commuter == other.commuter && customPostTax == other.customPostTax && customPreTax == other.customPreTax && fsaDependentCare == other.fsaDependentCare && fsaMedical == other.fsaMedical && hsaPost == other.hsaPost && hsaPre == other.hsaPre && s125Dental == other.s125Dental && s125Medical == other.s125Medical && s125Vision == other.s125Vision && simple == other.simple && simpleIra == other.simpleIra && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(s125Medical, s125Dental, s125Vision, hsaPre, hsaPost, fsaMedical, fsaDependentCare, simpleIra, simple, commuter, customPostTax, customPreTax, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(commuter, customPostTax, customPreTax, fsaDependentCare, fsaMedical, hsaPost, hsaPre, s125Dental, s125Medical, s125Vision, simple, simpleIra, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "BenefitsSupport{s125Medical=$s125Medical, s125Dental=$s125Dental, s125Vision=$s125Vision, hsaPre=$hsaPre, hsaPost=$hsaPost, fsaMedical=$fsaMedical, fsaDependentCare=$fsaDependentCare, simpleIra=$simpleIra, simple=$simple, commuter=$commuter, customPostTax=$customPostTax, customPreTax=$customPreTax, additionalProperties=$additionalProperties}" + "BenefitsSupport{commuter=$commuter, customPostTax=$customPostTax, customPreTax=$customPreTax, fsaDependentCare=$fsaDependentCare, fsaMedical=$fsaMedical, hsaPost=$hsaPost, hsaPre=$hsaPre, s125Dental=$s125Dental, s125Medical=$s125Medical, s125Vision=$s125Vision, simple=$simple, simpleIra=$simpleIra, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index 03b210ac..bca50d5c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -6,45 +6,70 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Company.Builder::class) @NoAutoDetect class Company +@JsonCreator private constructor( - private val id: JsonField, - 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, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("accounts") + @ExcludeMissing + private val accounts: JsonField> = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + private val departments: JsonField> = JsonMissing.of(), + @JsonProperty("ein") @ExcludeMissing private val ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") + @ExcludeMissing + private val entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + private val legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + private val locations: JsonField> = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + private val primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + private val primaryPhoneNumber: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** A stable Finch `id` (UUID v4) for the company. */ fun id(): String = id.getRequired("id") - /** The legal name of the company. */ - fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) + + /** 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")) /** The entity type object. */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + /** The legal name of the company. */ + fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + + fun locations(): Optional> = + Optional.ofNullable(locations.getNullable("locations")) + /** The email of the main administrator on the account. */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) @@ -53,27 +78,25 @@ private constructor( fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) - /** The array of company departments. */ - fun departments(): Optional> = - Optional.ofNullable(departments.getNullable("departments")) + /** A stable Finch `id` (UUID v4) for the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id - /** The employer identification number. */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + /** An array of bank account objects associated with the payroll/HRIS system. */ + @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts - fun locations(): Optional> = - Optional.ofNullable(locations.getNullable("locations")) + /** The array of company departments. */ + @JsonProperty("departments") @ExcludeMissing fun _departments() = departments - /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) + /** The employer identification number. */ + @JsonProperty("ein") @ExcludeMissing fun _ein() = ein - /** A stable Finch `id` (UUID v4) for the company. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The entity type object. */ + @JsonProperty("entity") @ExcludeMissing fun _entity() = entity /** The legal name of the company. */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName() = legalName - /** The entity type object. */ - @JsonProperty("entity") @ExcludeMissing fun _entity() = entity + @JsonProperty("locations") @ExcludeMissing fun _locations() = locations /** The email of the main administrator on the account. */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail() = primaryEmail @@ -83,32 +106,23 @@ private constructor( @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 + private var validated: Boolean = false + fun validate(): Company = apply { if (!validated) { id() - legalName() - entity().map { it.validate() } - primaryEmail() - primaryPhoneNumber() + accounts().map { it.forEach { it.validate() } } departments().map { it.forEach { it?.validate() } } ein() + entity().map { it.validate() } + legalName() locations().map { it.forEach { it?.validate() } } - accounts().map { it.forEach { it.validate() } } + primaryEmail() + primaryPhoneNumber() validated = true } } @@ -123,58 +137,76 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 accounts: JsonField> = JsonMissing.of() private var departments: JsonField> = JsonMissing.of() private var ein: JsonField = JsonMissing.of() + private var entity: JsonField = JsonMissing.of() + private var legalName: JsonField = JsonMissing.of() private var locations: JsonField> = JsonMissing.of() - private var accounts: JsonField> = JsonMissing.of() + private var primaryEmail: JsonField = JsonMissing.of() + private var primaryPhoneNumber: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(company: Company) = apply { - this.id = company.id - this.legalName = company.legalName - this.entity = company.entity - this.primaryEmail = company.primaryEmail - this.primaryPhoneNumber = company.primaryPhoneNumber - this.departments = company.departments - this.ein = company.ein - this.locations = company.locations - this.accounts = company.accounts - additionalProperties(company.additionalProperties) + id = company.id + accounts = company.accounts + departments = company.departments + ein = company.ein + entity = company.entity + legalName = company.legalName + locations = company.locations + primaryEmail = company.primaryEmail + primaryPhoneNumber = company.primaryPhoneNumber + additionalProperties = company.additionalProperties.toMutableMap() } /** A stable Finch `id` (UUID v4) for the company. */ fun id(id: String) = id(JsonField.of(id)) /** A stable Finch `id` (UUID v4) for the company. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } - /** The legal name of the company. */ - fun legalName(legalName: String) = legalName(JsonField.of(legalName)) + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: List) = accounts(JsonField.of(accounts)) - /** The legal name of the company. */ - @JsonProperty("legal_name") - @ExcludeMissing - fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: JsonField>) = apply { this.accounts = accounts } + + /** The array of company departments. */ + fun departments(departments: List) = departments(JsonField.of(departments)) + + /** The array of company departments. */ + fun departments(departments: JsonField>) = apply { + this.departments = departments + } + + /** The employer identification number. */ + fun ein(ein: String) = ein(JsonField.of(ein)) + + /** The employer identification number. */ + fun ein(ein: JsonField) = apply { this.ein = ein } /** 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 legal name of the company. */ + fun legalName(legalName: String) = legalName(JsonField.of(legalName)) + + /** The legal name of the company. */ + fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + + fun locations(locations: List) = locations(JsonField.of(locations)) + + fun locations(locations: JsonField>) = apply { this.locations = locations } + /** 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 } @@ -184,137 +216,119 @@ private constructor( 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Company = Company( id, - legalName, - entity, - primaryEmail, - primaryPhoneNumber, + accounts.map { it.toImmutable() }, departments.map { it.toImmutable() }, ein, + entity, + legalName, locations.map { it.toImmutable() }, - accounts.map { it.toImmutable() }, + primaryEmail, + primaryPhoneNumber, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Account.Builder::class) @NoAutoDetect class Account + @JsonCreator 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, + @JsonProperty("account_name") + @ExcludeMissing + private val accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + private val accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + private val accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + private val institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + private val routingNumber: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** - * 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")) + /** 10-12 digit number to specify the bank account */ + fun accountNumber(): Optional = + Optional.ofNullable(accountNumber.getNullable("account_number")) /** 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")) + /** Name of the banking institution. */ + fun institutionName(): Optional = + Optional.ofNullable(institutionName.getNullable("institution_name")) /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. */ - @JsonProperty("routing_number") @ExcludeMissing fun _routingNumber() = routingNumber + fun routingNumber(): Optional = + Optional.ofNullable(routingNumber.getNullable("routing_number")) /** 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 + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") @ExcludeMissing fun _accountNumber() = accountNumber /** 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 + /** Name of the banking institution. */ + @JsonProperty("institution_name") @ExcludeMissing fun _institutionName() = institutionName + + /** + * 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 @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Account = apply { if (!validated) { - routingNumber() accountName() - institutionName() - accountType() accountNumber() + accountType() + institutionName() + routingNumber() validated = true } } @@ -328,101 +342,96 @@ private constructor( 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 accountType: JsonField = JsonMissing.of() + private var institutionName: JsonField = JsonMissing.of() + private var routingNumber: 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 + accountName = account.accountName + accountNumber = account.accountNumber + accountType = account.accountType + institutionName = account.institutionName + routingNumber = account.routingNumber + additionalProperties = account.additionalProperties.toMutableMap() } /** 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)) + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: String) = accountNumber(JsonField.of(accountNumber)) - /** Name of the banking institution. */ - @JsonProperty("institution_name") - @ExcludeMissing - fun institutionName(institutionName: JsonField) = apply { - this.institutionName = institutionName + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: JsonField) = apply { + this.accountNumber = accountNumber } /** 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)) + /** Name of the banking institution. */ + fun institutionName(institutionName: String) = + institutionName(JsonField.of(institutionName)) - /** 10-12 digit number to specify the bank account */ - @JsonProperty("account_number") - @ExcludeMissing - fun accountNumber(accountNumber: JsonField) = apply { - this.accountNumber = accountNumber + /** Name of the banking institution. */ + fun institutionName(institutionName: JsonField) = apply { + this.institutionName = institutionName + } + + /** + * 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. + */ + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Account = Account( - routingNumber, accountName, - institutionName, - accountType, accountNumber, + accountType, + institutionName, + routingNumber, additionalProperties.toImmutable(), ) } @@ -489,30 +498,33 @@ private constructor( return true } - return /* spotless:off */ other is Account && routingNumber == other.routingNumber && accountName == other.accountName && institutionName == other.institutionName && accountType == other.accountType && accountNumber == other.accountNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Account && accountName == other.accountName && accountNumber == other.accountNumber && accountType == other.accountType && institutionName == other.institutionName && routingNumber == other.routingNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(routingNumber, accountName, institutionName, accountType, accountNumber, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountName, accountNumber, accountType, institutionName, routingNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Account{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + "Account{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val parent: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("parent") + @ExcludeMissing + private val parent: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The department name. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -529,6 +541,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -552,41 +566,42 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - this.parent = department.parent - additionalProperties(department.additionalProperties) + name = department.name + parent = department.parent + additionalProperties = department.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department( name, @@ -596,16 +611,17 @@ private constructor( } /** The parent department, if present. */ - @JsonDeserialize(builder = Parent.Builder::class) @NoAutoDetect class Parent + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The parent department's name. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -616,6 +632,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Parent = apply { if (!validated) { name() @@ -637,26 +655,23 @@ private constructor( @JvmSynthetic internal fun from(parent: Parent) = apply { - this.name = parent.name - additionalProperties(parent.additionalProperties) + name = parent.name + additionalProperties = parent.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -664,6 +679,14 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -704,37 +727,40 @@ private constructor( } /** The entity type object. */ - @JsonDeserialize(builder = Entity.Builder::class) @NoAutoDetect class Entity + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The tax payer subtype of the company. */ + fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) /** 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")) + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = 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 + private var validated: Boolean = false + fun validate(): Entity = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -748,51 +774,52 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = entity.subtype + type = entity.type + additionalProperties = entity.additionalProperties.toMutableMap() } - /** 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 } + /** The tax payer type of the company. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The tax payer type of the company. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Entity = Entity( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -952,17 +979,17 @@ private constructor( return true } - return /* spotless:off */ other is Entity && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Entity && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -970,15 +997,15 @@ private constructor( return true } - return /* spotless:off */ other is Company && id == other.id && legalName == other.legalName && entity == other.entity && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && departments == other.departments && ein == other.ein && locations == other.locations && accounts == other.accounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Company && id == other.id && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, legalName, entity, primaryEmail, primaryPhoneNumber, departments, ein, locations, accounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Company{id=$id, legalName=$legalName, entity=$entity, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, departments=$departments, ein=$ein, locations=$locations, accounts=$accounts, additionalProperties=$additionalProperties}" + "Company{id=$id, accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt index 3986bf3b..d1ba1f43 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt @@ -4,60 +4,69 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = CompanyBenefit.Builder::class) @NoAutoDetect class CompanyBenefit +@JsonCreator private constructor( - private val benefitId: JsonField, - private val type: JsonField, - private val description: JsonField, - private val frequency: JsonField, - private val additionalProperties: Map, + @JsonProperty("benefit_id") + @ExcludeMissing + private val benefitId: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("frequency") + @ExcludeMissing + private val frequency: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun benefitId(): String = benefitId.getRequired("benefit_id") - /** Type of benefit. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun description(): Optional = Optional.ofNullable(description.getNullable("description")) fun frequency(): Optional = Optional.ofNullable(frequency.getNullable("frequency")) - @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId() = benefitId - /** Type of benefit. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId() = benefitId @JsonProperty("description") @ExcludeMissing fun _description() = description @JsonProperty("frequency") @ExcludeMissing fun _frequency() = frequency + /** Type of benefit. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): CompanyBenefit = apply { if (!validated) { benefitId() - type() description() frequency() + type() validated = true } } @@ -72,66 +81,63 @@ private constructor( class Builder { private var benefitId: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var frequency: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(companyBenefit: CompanyBenefit) = apply { - this.benefitId = companyBenefit.benefitId - this.type = companyBenefit.type - this.description = companyBenefit.description - this.frequency = companyBenefit.frequency - additionalProperties(companyBenefit.additionalProperties) + benefitId = companyBenefit.benefitId + description = companyBenefit.description + frequency = companyBenefit.frequency + type = companyBenefit.type + additionalProperties = companyBenefit.additionalProperties.toMutableMap() } fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) - @JsonProperty("benefit_id") - @ExcludeMissing fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } - /** Type of benefit. */ - fun type(type: BenefitType) = type(JsonField.of(type)) - - /** Type of benefit. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - fun description(description: String) = description(JsonField.of(description)) - @JsonProperty("description") - @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } fun frequency(frequency: BenefitFrequency) = frequency(JsonField.of(frequency)) - @JsonProperty("frequency") - @ExcludeMissing fun frequency(frequency: JsonField) = apply { this.frequency = frequency } + /** Type of benefit. */ + fun type(type: BenefitType) = type(JsonField.of(type)) + + /** Type of benefit. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CompanyBenefit = CompanyBenefit( benefitId, - type, description, frequency, + type, additionalProperties.toImmutable(), ) } @@ -141,15 +147,15 @@ private constructor( return true } - return /* spotless:off */ other is CompanyBenefit && benefitId == other.benefitId && type == other.type && description == other.description && frequency == other.frequency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CompanyBenefit && benefitId == other.benefitId && description == other.description && frequency == other.frequency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(benefitId, type, description, frequency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(benefitId, description, frequency, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CompanyBenefit{benefitId=$benefitId, type=$type, description=$description, frequency=$frequency, additionalProperties=$additionalProperties}" + "CompanyBenefit{benefitId=$benefitId, description=$description, frequency=$frequency, type=$type, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index 513dfd54..db775844 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = CompanyEvent.Builder::class) @NoAutoDetect class CompanyEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): CompanyEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,111 +110,107 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(companyEvent: CompanyEvent) = apply { - this.connectionId = companyEvent.connectionId - this.companyId = companyEvent.companyId - this.accountId = companyEvent.accountId - this.eventType = companyEvent.eventType - this.data = companyEvent.data - additionalProperties(companyEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = companyEvent.accountId + companyId = companyEvent.companyId + connectionId = companyEvent.connectionId + data = companyEvent.data + eventType = companyEvent.eventType + additionalProperties = companyEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CompanyEvent = CompanyEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val additionalProperties: Map, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { validated = true @@ -226,23 +230,28 @@ private constructor( @JvmSynthetic internal fun from(data: Data) = apply { - additionalProperties(data.additionalProperties) + additionalProperties = data.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data(additionalProperties.toImmutable()) } @@ -319,15 +328,15 @@ private constructor( return true } - return /* spotless:off */ other is CompanyEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CompanyEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CompanyEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "CompanyEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 0883a88f..d73e6600 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -6,41 +6,66 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = CompanyUpdateResponse.Builder::class) @NoAutoDetect class CompanyUpdateResponse +@JsonCreator 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, + @JsonProperty("accounts") + @ExcludeMissing + private val accounts: JsonField> = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + private val departments: JsonField> = JsonMissing.of(), + @JsonProperty("ein") @ExcludeMissing private val ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") + @ExcludeMissing + private val entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + private val legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + private val locations: JsonField> = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + private val primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + private val primaryPhoneNumber: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** 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. */ - fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + /** 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")) /** The entity type object. */ fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + /** The legal name of the company. */ + fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) + + fun locations(): Optional> = + Optional.ofNullable(locations.getNullable("locations")) + /** The email of the main administrator on the account. */ fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) @@ -49,24 +74,22 @@ private constructor( fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) + /** An array of bank account objects associated with the payroll/HRIS system. */ + @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts + /** The array of company departments. */ - fun departments(): Optional> = - Optional.ofNullable(departments.getNullable("departments")) + @JsonProperty("departments") @ExcludeMissing fun _departments() = departments /** The employer identification number. */ - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) - - fun locations(): Optional> = - Optional.ofNullable(locations.getNullable("locations")) + @JsonProperty("ein") @ExcludeMissing fun _ein() = ein - /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(): Optional> = Optional.ofNullable(accounts.getNullable("accounts")) + /** The entity type object. */ + @JsonProperty("entity") @ExcludeMissing fun _entity() = entity /** The legal name of the company. */ @JsonProperty("legal_name") @ExcludeMissing fun _legalName() = legalName - /** The entity type object. */ - @JsonProperty("entity") @ExcludeMissing fun _entity() = entity + @JsonProperty("locations") @ExcludeMissing fun _locations() = locations /** The email of the main administrator on the account. */ @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail() = primaryEmail @@ -76,31 +99,22 @@ private constructor( @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 + private var validated: Boolean = false + fun validate(): CompanyUpdateResponse = apply { if (!validated) { - legalName() - entity().map { it.validate() } - primaryEmail() - primaryPhoneNumber() + accounts().map { it.forEach { it.validate() } } departments().map { it.forEach { it?.validate() } } ein() + entity().map { it.validate() } + legalName() locations().map { it.forEach { it?.validate() } } - accounts().map { it.forEach { it.validate() } } + primaryEmail() + primaryPhoneNumber() validated = true } } @@ -114,51 +128,69 @@ private constructor( 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 accounts: JsonField> = JsonMissing.of() private var departments: JsonField> = JsonMissing.of() private var ein: JsonField = JsonMissing.of() + private var entity: JsonField = JsonMissing.of() + private var legalName: JsonField = JsonMissing.of() private var locations: JsonField> = JsonMissing.of() - private var accounts: JsonField> = JsonMissing.of() + private var primaryEmail: JsonField = JsonMissing.of() + private var primaryPhoneNumber: 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) + accounts = companyUpdateResponse.accounts + departments = companyUpdateResponse.departments + ein = companyUpdateResponse.ein + entity = companyUpdateResponse.entity + legalName = companyUpdateResponse.legalName + locations = companyUpdateResponse.locations + primaryEmail = companyUpdateResponse.primaryEmail + primaryPhoneNumber = companyUpdateResponse.primaryPhoneNumber + additionalProperties = companyUpdateResponse.additionalProperties.toMutableMap() } - /** The legal name of the company. */ - fun legalName(legalName: String) = legalName(JsonField.of(legalName)) + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: List) = accounts(JsonField.of(accounts)) - /** The legal name of the company. */ - @JsonProperty("legal_name") - @ExcludeMissing - fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: JsonField>) = apply { this.accounts = accounts } + + /** The array of company departments. */ + fun departments(departments: List) = departments(JsonField.of(departments)) + + /** The array of company departments. */ + fun departments(departments: JsonField>) = apply { + this.departments = departments + } + + /** The employer identification number. */ + fun ein(ein: String) = ein(JsonField.of(ein)) + + /** The employer identification number. */ + fun ein(ein: JsonField) = apply { this.ein = ein } /** 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 legal name of the company. */ + fun legalName(legalName: String) = legalName(JsonField.of(legalName)) + + /** The legal name of the company. */ + fun legalName(legalName: JsonField) = apply { this.legalName = legalName } + + fun locations(locations: List) = locations(JsonField.of(locations)) + + fun locations(locations: JsonField>) = apply { this.locations = locations } + /** 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 } @@ -168,136 +200,118 @@ private constructor( 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CompanyUpdateResponse = CompanyUpdateResponse( - legalName, - entity, - primaryEmail, - primaryPhoneNumber, + accounts.map { it.toImmutable() }, departments.map { it.toImmutable() }, ein, + entity, + legalName, locations.map { it.toImmutable() }, - accounts.map { it.toImmutable() }, + primaryEmail, + primaryPhoneNumber, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Account.Builder::class) @NoAutoDetect class Account + @JsonCreator 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, + @JsonProperty("account_name") + @ExcludeMissing + private val accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + private val accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + private val accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + private val institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + private val routingNumber: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** - * 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")) + /** 10-12 digit number to specify the bank account */ + fun accountNumber(): Optional = + Optional.ofNullable(accountNumber.getNullable("account_number")) /** 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")) + /** Name of the banking institution. */ + fun institutionName(): Optional = + Optional.ofNullable(institutionName.getNullable("institution_name")) /** * A nine-digit code that's based on the U.S. Bank location where your account was opened. */ - @JsonProperty("routing_number") @ExcludeMissing fun _routingNumber() = routingNumber + fun routingNumber(): Optional = + Optional.ofNullable(routingNumber.getNullable("routing_number")) /** 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 + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") @ExcludeMissing fun _accountNumber() = accountNumber /** 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 + /** Name of the banking institution. */ + @JsonProperty("institution_name") @ExcludeMissing fun _institutionName() = institutionName + + /** + * 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 @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Account = apply { if (!validated) { - routingNumber() accountName() - institutionName() - accountType() accountNumber() + accountType() + institutionName() + routingNumber() validated = true } } @@ -311,101 +325,96 @@ private constructor( 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 accountType: JsonField = JsonMissing.of() + private var institutionName: JsonField = JsonMissing.of() + private var routingNumber: 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 + accountName = account.accountName + accountNumber = account.accountNumber + accountType = account.accountType + institutionName = account.institutionName + routingNumber = account.routingNumber + additionalProperties = account.additionalProperties.toMutableMap() } /** 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)) + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: String) = accountNumber(JsonField.of(accountNumber)) - /** Name of the banking institution. */ - @JsonProperty("institution_name") - @ExcludeMissing - fun institutionName(institutionName: JsonField) = apply { - this.institutionName = institutionName + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: JsonField) = apply { + this.accountNumber = accountNumber } /** 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)) + /** Name of the banking institution. */ + fun institutionName(institutionName: String) = + institutionName(JsonField.of(institutionName)) - /** 10-12 digit number to specify the bank account */ - @JsonProperty("account_number") - @ExcludeMissing - fun accountNumber(accountNumber: JsonField) = apply { - this.accountNumber = accountNumber + /** Name of the banking institution. */ + fun institutionName(institutionName: JsonField) = apply { + this.institutionName = institutionName + } + + /** + * 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. + */ + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Account = Account( - routingNumber, accountName, - institutionName, - accountType, accountNumber, + accountType, + institutionName, + routingNumber, additionalProperties.toImmutable(), ) } @@ -472,30 +481,33 @@ private constructor( return true } - return /* spotless:off */ other is Account && routingNumber == other.routingNumber && accountName == other.accountName && institutionName == other.institutionName && accountType == other.accountType && accountNumber == other.accountNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Account && accountName == other.accountName && accountNumber == other.accountNumber && accountType == other.accountType && institutionName == other.institutionName && routingNumber == other.routingNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(routingNumber, accountName, institutionName, accountType, accountNumber, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountName, accountNumber, accountType, institutionName, routingNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Account{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + "Account{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val parent: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("parent") + @ExcludeMissing + private val parent: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The department name. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -512,6 +524,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -535,41 +549,42 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - this.parent = department.parent - additionalProperties(department.additionalProperties) + name = department.name + parent = department.parent + additionalProperties = department.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department( name, @@ -579,16 +594,17 @@ private constructor( } /** The parent department, if present. */ - @JsonDeserialize(builder = Parent.Builder::class) @NoAutoDetect class Parent + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The parent department's name. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -599,6 +615,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Parent = apply { if (!validated) { name() @@ -620,26 +638,23 @@ private constructor( @JvmSynthetic internal fun from(parent: Parent) = apply { - this.name = parent.name - additionalProperties(parent.additionalProperties) + name = parent.name + additionalProperties = parent.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -647,6 +662,14 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -687,37 +710,40 @@ private constructor( } /** The entity type object. */ - @JsonDeserialize(builder = Entity.Builder::class) @NoAutoDetect class Entity + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The tax payer subtype of the company. */ + fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) /** 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")) + @JsonProperty("subtype") @ExcludeMissing fun _subtype() = 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 + private var validated: Boolean = false + fun validate(): Entity = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -731,51 +757,52 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = entity.subtype + type = entity.type + additionalProperties = entity.additionalProperties.toMutableMap() } - /** 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 } + /** The tax payer type of the company. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The tax payer type of the company. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Entity = Entity( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -935,17 +962,17 @@ private constructor( return true } - return /* spotless:off */ other is Entity && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Entity && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -953,15 +980,15 @@ private constructor( return true } - return /* spotless:off */ other is CompanyUpdateResponse && legalName == other.legalName && entity == other.entity && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && departments == other.departments && ein == other.ein && locations == other.locations && accounts == other.accounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CompanyUpdateResponse && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(legalName, entity, primaryEmail, primaryPhoneNumber, departments, ein, locations, accounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CompanyUpdateResponse{legalName=$legalName, entity=$entity, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, departments=$departments, ein=$ein, locations=$locations, accounts=$accounts, additionalProperties=$additionalProperties}" + "CompanyUpdateResponse{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt index 7b723f01..687966ca 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -21,100 +21,83 @@ import java.util.Optional class ConnectSessionNewParams constructor( - private val customerId: String, - private val customerName: String, - private val products: List, - private val customerEmail: String?, - private val integration: Integration?, - private val manual: Boolean?, - private val minutesToExpire: Double?, - private val redirectUri: String?, - private val sandbox: Sandbox?, + private val body: ConnectSessionNewBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun customerId(): String = customerId + fun customerId(): String = body.customerId() - fun customerName(): String = customerName + fun customerName(): String = body.customerName() - fun products(): List = products + fun products(): List = body.products() - fun customerEmail(): Optional = Optional.ofNullable(customerEmail) + fun customerEmail(): Optional = body.customerEmail() - fun integration(): Optional = Optional.ofNullable(integration) + fun integration(): Optional = body.integration() - fun manual(): Optional = Optional.ofNullable(manual) + fun manual(): Optional = body.manual() - fun minutesToExpire(): Optional = Optional.ofNullable(minutesToExpire) + /** The number of minutes until the session expires (defaults to 20,160, which is 14 days) */ + fun minutesToExpire(): Optional = body.minutesToExpire() - fun redirectUri(): Optional = Optional.ofNullable(redirectUri) + fun redirectUri(): Optional = body.redirectUri() - fun sandbox(): Optional = Optional.ofNullable(sandbox) + fun sandbox(): Optional = body.sandbox() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): ConnectSessionNewBody { - return ConnectSessionNewBody( - customerId, - customerName, - products, - customerEmail, - integration, - manual, - minutesToExpire, - redirectUri, - sandbox, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): ConnectSessionNewBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = ConnectSessionNewBody.Builder::class) @NoAutoDetect class ConnectSessionNewBody + @JsonCreator internal constructor( - private val customerId: String?, - private val customerName: String?, - private val products: List?, - private val customerEmail: String?, - private val integration: Integration?, - private val manual: Boolean?, - private val minutesToExpire: Double?, - private val redirectUri: String?, - private val sandbox: Sandbox?, - private val additionalProperties: Map, + @JsonProperty("customer_id") private val customerId: String, + @JsonProperty("customer_name") private val customerName: String, + @JsonProperty("products") private val products: List, + @JsonProperty("customer_email") private val customerEmail: String?, + @JsonProperty("integration") private val integration: Integration?, + @JsonProperty("manual") private val manual: Boolean?, + @JsonProperty("minutes_to_expire") private val minutesToExpire: Double?, + @JsonProperty("redirect_uri") private val redirectUri: String?, + @JsonProperty("sandbox") private val sandbox: Sandbox?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("customer_id") fun customerId(): String? = customerId + @JsonProperty("customer_id") fun customerId(): String = customerId - @JsonProperty("customer_name") fun customerName(): String? = customerName + @JsonProperty("customer_name") fun customerName(): String = customerName - @JsonProperty("products") fun products(): List? = products + @JsonProperty("products") fun products(): List = products - @JsonProperty("customer_email") fun customerEmail(): String? = customerEmail + @JsonProperty("customer_email") + fun customerEmail(): Optional = Optional.ofNullable(customerEmail) - @JsonProperty("integration") fun integration(): Integration? = integration + @JsonProperty("integration") + fun integration(): Optional = Optional.ofNullable(integration) - @JsonProperty("manual") fun manual(): Boolean? = manual + @JsonProperty("manual") fun manual(): Optional = Optional.ofNullable(manual) /** * The number of minutes until the session expires (defaults to 20,160, which is 14 days) */ - @JsonProperty("minutes_to_expire") fun minutesToExpire(): Double? = minutesToExpire + @JsonProperty("minutes_to_expire") + fun minutesToExpire(): Optional = Optional.ofNullable(minutesToExpire) - @JsonProperty("redirect_uri") fun redirectUri(): String? = redirectUri + @JsonProperty("redirect_uri") + fun redirectUri(): Optional = Optional.ofNullable(redirectUri) - @JsonProperty("sandbox") fun sandbox(): Sandbox? = sandbox + @JsonProperty("sandbox") fun sandbox(): Optional = Optional.ofNullable(sandbox) @JsonAnyGetter @ExcludeMissing @@ -131,7 +114,7 @@ constructor( private var customerId: String? = null private var customerName: String? = null - private var products: List? = null + private var products: MutableList? = null private var customerEmail: String? = null private var integration: Integration? = null private var manual: Boolean? = null @@ -142,64 +125,97 @@ constructor( @JvmSynthetic internal fun from(connectSessionNewBody: ConnectSessionNewBody) = apply { - this.customerId = connectSessionNewBody.customerId - this.customerName = connectSessionNewBody.customerName - this.products = connectSessionNewBody.products - this.customerEmail = connectSessionNewBody.customerEmail - this.integration = connectSessionNewBody.integration - this.manual = connectSessionNewBody.manual - this.minutesToExpire = connectSessionNewBody.minutesToExpire - this.redirectUri = connectSessionNewBody.redirectUri - this.sandbox = connectSessionNewBody.sandbox - additionalProperties(connectSessionNewBody.additionalProperties) + customerId = connectSessionNewBody.customerId + customerName = connectSessionNewBody.customerName + products = connectSessionNewBody.products.toMutableList() + customerEmail = connectSessionNewBody.customerEmail + integration = connectSessionNewBody.integration + manual = connectSessionNewBody.manual + minutesToExpire = connectSessionNewBody.minutesToExpire + redirectUri = connectSessionNewBody.redirectUri + sandbox = connectSessionNewBody.sandbox + additionalProperties = connectSessionNewBody.additionalProperties.toMutableMap() } - @JsonProperty("customer_id") fun customerId(customerId: String) = apply { this.customerId = customerId } - @JsonProperty("customer_name") fun customerName(customerName: String) = apply { this.customerName = customerName } - @JsonProperty("products") - fun products(products: List) = apply { this.products = products } + fun products(products: List) = apply { + this.products = products.toMutableList() + } + + fun addProduct(product: ConnectProducts) = apply { + products = (products ?: mutableListOf()).apply { add(product) } + } + + fun customerEmail(customerEmail: String?) = apply { this.customerEmail = customerEmail } - @JsonProperty("customer_email") - fun customerEmail(customerEmail: String) = apply { this.customerEmail = customerEmail } + fun customerEmail(customerEmail: Optional) = + customerEmail(customerEmail.orElse(null)) - @JsonProperty("integration") - fun integration(integration: Integration) = apply { this.integration = integration } + fun integration(integration: Integration?) = apply { this.integration = integration } - @JsonProperty("manual") fun manual(manual: Boolean) = apply { this.manual = manual } + fun integration(integration: Optional) = + integration(integration.orElse(null)) + + fun manual(manual: Boolean?) = apply { this.manual = manual } + + fun manual(manual: Boolean) = manual(manual as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun manual(manual: Optional) = manual(manual.orElse(null) as Boolean?) /** * The number of minutes until the session expires (defaults to 20,160, which is 14 * days) */ - @JsonProperty("minutes_to_expire") - fun minutesToExpire(minutesToExpire: Double) = apply { + fun minutesToExpire(minutesToExpire: Double?) = apply { this.minutesToExpire = minutesToExpire } - @JsonProperty("redirect_uri") - fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 + * days) + */ + fun minutesToExpire(minutesToExpire: Double) = + minutesToExpire(minutesToExpire as Double?) - @JsonProperty("sandbox") - fun sandbox(sandbox: Sandbox) = apply { this.sandbox = sandbox } + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 + * days) + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.orElse(null) as Double?) + + fun redirectUri(redirectUri: String?) = apply { this.redirectUri = redirectUri } + + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) + + fun sandbox(sandbox: Sandbox?) = apply { this.sandbox = sandbox } + + fun sandbox(sandbox: Optional) = sandbox(sandbox.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ConnectSessionNewBody = ConnectSessionNewBody( checkNotNull(customerId) { "`customerId` is required but was not set" }, @@ -244,63 +260,67 @@ constructor( @NoAutoDetect class Builder { - private var customerId: String? = null - private var customerName: String? = null - private var products: MutableList = mutableListOf() - private var customerEmail: String? = null - private var integration: Integration? = null - private var manual: Boolean? = null - private var minutesToExpire: Double? = null - private var redirectUri: String? = null - private var sandbox: Sandbox? = null + private var body: ConnectSessionNewBody.Builder = ConnectSessionNewBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectSessionNewParams: ConnectSessionNewParams) = apply { - customerId = connectSessionNewParams.customerId - customerName = connectSessionNewParams.customerName - products = connectSessionNewParams.products.toMutableList() - customerEmail = connectSessionNewParams.customerEmail - integration = connectSessionNewParams.integration - manual = connectSessionNewParams.manual - minutesToExpire = connectSessionNewParams.minutesToExpire - redirectUri = connectSessionNewParams.redirectUri - sandbox = connectSessionNewParams.sandbox + body = connectSessionNewParams.body.toBuilder() additionalHeaders = connectSessionNewParams.additionalHeaders.toBuilder() additionalQueryParams = connectSessionNewParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - connectSessionNewParams.additionalBodyProperties.toMutableMap() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun customerId(customerId: String) = apply { body.customerId(customerId) } - fun customerName(customerName: String) = apply { this.customerName = customerName } + fun customerName(customerName: String) = apply { body.customerName(customerName) } - fun products(products: List) = apply { - this.products.clear() - this.products.addAll(products) - } + fun products(products: List) = apply { body.products(products) } - fun addProduct(product: ConnectProducts) = apply { this.products.add(product) } + fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } - fun customerEmail(customerEmail: String) = apply { this.customerEmail = customerEmail } + fun customerEmail(customerEmail: String?) = apply { body.customerEmail(customerEmail) } - fun integration(integration: Integration) = apply { this.integration = integration } + fun customerEmail(customerEmail: Optional) = + customerEmail(customerEmail.orElse(null)) - fun manual(manual: Boolean) = apply { this.manual = manual } + fun integration(integration: Integration?) = apply { body.integration(integration) } + + fun integration(integration: Optional) = integration(integration.orElse(null)) + + fun manual(manual: Boolean?) = apply { body.manual(manual) } + + fun manual(manual: Boolean) = manual(manual as Boolean?) + + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun manual(manual: Optional) = manual(manual.orElse(null) as Boolean?) /** * The number of minutes until the session expires (defaults to 20,160, which is 14 days) */ - fun minutesToExpire(minutesToExpire: Double) = apply { - this.minutesToExpire = minutesToExpire + fun minutesToExpire(minutesToExpire: Double?) = apply { + body.minutesToExpire(minutesToExpire) } - fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 days) + */ + fun minutesToExpire(minutesToExpire: Double) = minutesToExpire(minutesToExpire as Double?) + + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 days) + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.orElse(null) as Double?) + + fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } + + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) - fun sandbox(sandbox: Sandbox) = apply { this.sandbox = sandbox } + fun sandbox(sandbox: Sandbox?) = apply { body.sandbox(sandbox) } + + fun sandbox(sandbox: Optional) = sandbox(sandbox.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -401,41 +421,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): ConnectSessionNewParams = ConnectSessionNewParams( - checkNotNull(customerId) { "`customerId` is required but was not set" }, - checkNotNull(customerName) { "`customerName` is required but was not set" }, - products.toImmutable(), - customerEmail, - integration, - manual, - minutesToExpire, - redirectUri, - sandbox, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -532,18 +540,20 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Integration.Builder::class) @NoAutoDetect class Integration + @JsonCreator private constructor( - private val provider: String?, - private val authMethod: AuthMethod?, - private val additionalProperties: Map, + @JsonProperty("auth_method") private val authMethod: AuthMethod?, + @JsonProperty("provider") private val provider: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("provider") fun provider(): String? = provider + @JsonProperty("auth_method") + fun authMethod(): Optional = Optional.ofNullable(authMethod) - @JsonProperty("auth_method") fun authMethod(): AuthMethod? = authMethod + @JsonProperty("provider") fun provider(): Optional = Optional.ofNullable(provider) @JsonAnyGetter @ExcludeMissing @@ -558,41 +568,48 @@ constructor( class Builder { - private var provider: String? = null private var authMethod: AuthMethod? = null + private var provider: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(integration: Integration) = apply { - this.provider = integration.provider - this.authMethod = integration.authMethod - additionalProperties(integration.additionalProperties) + authMethod = integration.authMethod + provider = integration.provider + additionalProperties = integration.additionalProperties.toMutableMap() } - @JsonProperty("provider") - fun provider(provider: String) = apply { this.provider = provider } + fun authMethod(authMethod: AuthMethod?) = apply { this.authMethod = authMethod } + + fun authMethod(authMethod: Optional) = authMethod(authMethod.orElse(null)) + + fun provider(provider: String?) = apply { this.provider = provider } - @JsonProperty("auth_method") - fun authMethod(authMethod: AuthMethod) = apply { this.authMethod = authMethod } + fun provider(provider: Optional) = provider(provider.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Integration = Integration( - provider, authMethod, + provider, additionalProperties.toImmutable(), ) } @@ -671,17 +688,17 @@ constructor( return true } - return /* spotless:off */ other is Integration && provider == other.provider && authMethod == other.authMethod && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Integration && authMethod == other.authMethod && provider == other.provider && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(provider, authMethod, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(authMethod, provider, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Integration{provider=$provider, authMethod=$authMethod, additionalProperties=$additionalProperties}" + "Integration{authMethod=$authMethod, provider=$provider, additionalProperties=$additionalProperties}" } class Sandbox @@ -746,11 +763,11 @@ constructor( return true } - return /* spotless:off */ other is ConnectSessionNewParams && customerId == other.customerId && customerName == other.customerName && products == other.products && customerEmail == other.customerEmail && integration == other.integration && manual == other.manual && minutesToExpire == other.minutesToExpire && redirectUri == other.redirectUri && sandbox == other.sandbox && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ConnectSessionNewParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, customerName, products, customerEmail, integration, manual, minutesToExpire, redirectUri, sandbox, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ConnectSessionNewParams{customerId=$customerId, customerName=$customerName, products=$products, customerEmail=$customerEmail, integration=$integration, manual=$manual, minutesToExpire=$minutesToExpire, redirectUri=$redirectUri, sandbox=$sandbox, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ConnectSessionNewParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt index 60a3ba1a..6dd995e6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -21,68 +21,63 @@ import java.util.Optional class ConnectSessionReauthenticateParams constructor( - private val connectionId: String, - private val minutesToExpire: Long?, - private val products: List?, - private val redirectUri: String?, + private val body: ConnectSessionReauthenticateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun connectionId(): String = connectionId + /** The ID of the existing connection to reauthenticate */ + fun connectionId(): String = body.connectionId() - fun minutesToExpire(): Optional = Optional.ofNullable(minutesToExpire) + /** The number of minutes until the session expires (defaults to 20,160, which is 14 days) */ + fun minutesToExpire(): Optional = body.minutesToExpire() - fun products(): Optional> = Optional.ofNullable(products) + /** The products to request access to (optional for reauthentication) */ + fun products(): Optional> = body.products() - fun redirectUri(): Optional = Optional.ofNullable(redirectUri) + /** The URI to redirect to after the Connect flow is completed */ + fun redirectUri(): Optional = body.redirectUri() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): ConnectSessionReauthenticateBody { - return ConnectSessionReauthenticateBody( - connectionId, - minutesToExpire, - products, - redirectUri, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): ConnectSessionReauthenticateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = ConnectSessionReauthenticateBody.Builder::class) @NoAutoDetect class ConnectSessionReauthenticateBody + @JsonCreator internal constructor( - private val connectionId: String?, - private val minutesToExpire: Long?, - private val products: List?, - private val redirectUri: String?, - private val additionalProperties: Map, + @JsonProperty("connection_id") private val connectionId: String, + @JsonProperty("minutes_to_expire") private val minutesToExpire: Long?, + @JsonProperty("products") private val products: List?, + @JsonProperty("redirect_uri") private val redirectUri: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The ID of the existing connection to reauthenticate */ - @JsonProperty("connection_id") fun connectionId(): String? = connectionId + @JsonProperty("connection_id") fun connectionId(): String = connectionId /** * The number of minutes until the session expires (defaults to 20,160, which is 14 days) */ - @JsonProperty("minutes_to_expire") fun minutesToExpire(): Long? = minutesToExpire + @JsonProperty("minutes_to_expire") + fun minutesToExpire(): Optional = Optional.ofNullable(minutesToExpire) /** The products to request access to (optional for reauthentication) */ - @JsonProperty("products") fun products(): List? = products + @JsonProperty("products") + fun products(): Optional> = Optional.ofNullable(products) /** The URI to redirect to after the Connect flow is completed */ - @JsonProperty("redirect_uri") fun redirectUri(): String? = redirectUri + @JsonProperty("redirect_uri") + fun redirectUri(): Optional = Optional.ofNullable(redirectUri) @JsonAnyGetter @ExcludeMissing @@ -99,55 +94,85 @@ constructor( private var connectionId: String? = null private var minutesToExpire: Long? = null - private var products: List? = null + private var products: MutableList? = null private var redirectUri: String? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectSessionReauthenticateBody: ConnectSessionReauthenticateBody) = apply { - this.connectionId = connectSessionReauthenticateBody.connectionId - this.minutesToExpire = connectSessionReauthenticateBody.minutesToExpire - this.products = connectSessionReauthenticateBody.products - this.redirectUri = connectSessionReauthenticateBody.redirectUri - additionalProperties(connectSessionReauthenticateBody.additionalProperties) + connectionId = connectSessionReauthenticateBody.connectionId + minutesToExpire = connectSessionReauthenticateBody.minutesToExpire + products = connectSessionReauthenticateBody.products?.toMutableList() + redirectUri = connectSessionReauthenticateBody.redirectUri + additionalProperties = + connectSessionReauthenticateBody.additionalProperties.toMutableMap() } /** The ID of the existing connection to reauthenticate */ - @JsonProperty("connection_id") fun connectionId(connectionId: String) = apply { this.connectionId = connectionId } /** * The number of minutes until the session expires (defaults to 20,160, which is 14 * days) */ - @JsonProperty("minutes_to_expire") - fun minutesToExpire(minutesToExpire: Long) = apply { + fun minutesToExpire(minutesToExpire: Long?) = apply { this.minutesToExpire = minutesToExpire } + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 + * days) + */ + fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) + + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 + * days) + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.orElse(null) as Long?) + + /** The products to request access to (optional for reauthentication) */ + fun products(products: List?) = apply { + this.products = products?.toMutableList() + } + /** The products to request access to (optional for reauthentication) */ - @JsonProperty("products") - fun products(products: List) = apply { this.products = products } + fun products(products: Optional>) = + products(products.orElse(null)) + + /** The products to request access to (optional for reauthentication) */ + fun addProduct(product: ConnectProducts) = apply { + products = (products ?: mutableListOf()).apply { add(product) } + } /** The URI to redirect to after the Connect flow is completed */ - @JsonProperty("redirect_uri") - fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + fun redirectUri(redirectUri: String?) = apply { this.redirectUri = redirectUri } + + /** The URI to redirect to after the Connect flow is completed */ + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ConnectSessionReauthenticateBody = ConnectSessionReauthenticateBody( checkNotNull(connectionId) { "`connectionId` is required but was not set" }, @@ -186,50 +211,56 @@ constructor( @NoAutoDetect class Builder { - private var connectionId: String? = null - private var minutesToExpire: Long? = null - private var products: MutableList = mutableListOf() - private var redirectUri: String? = null + private var body: ConnectSessionReauthenticateBody.Builder = + ConnectSessionReauthenticateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectSessionReauthenticateParams: ConnectSessionReauthenticateParams) = apply { - connectionId = connectSessionReauthenticateParams.connectionId - minutesToExpire = connectSessionReauthenticateParams.minutesToExpire - products = - connectSessionReauthenticateParams.products?.toMutableList() ?: mutableListOf() - redirectUri = connectSessionReauthenticateParams.redirectUri + body = connectSessionReauthenticateParams.body.toBuilder() additionalHeaders = connectSessionReauthenticateParams.additionalHeaders.toBuilder() additionalQueryParams = connectSessionReauthenticateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - connectSessionReauthenticateParams.additionalBodyProperties.toMutableMap() } /** The ID of the existing connection to reauthenticate */ - fun connectionId(connectionId: String) = apply { this.connectionId = connectionId } + fun connectionId(connectionId: String) = apply { body.connectionId(connectionId) } /** * The number of minutes until the session expires (defaults to 20,160, which is 14 days) */ - fun minutesToExpire(minutesToExpire: Long) = apply { - this.minutesToExpire = minutesToExpire + fun minutesToExpire(minutesToExpire: Long?) = apply { + body.minutesToExpire(minutesToExpire) } + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 days) + */ + fun minutesToExpire(minutesToExpire: Long) = minutesToExpire(minutesToExpire as Long?) + + /** + * The number of minutes until the session expires (defaults to 20,160, which is 14 days) + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun minutesToExpire(minutesToExpire: Optional) = + minutesToExpire(minutesToExpire.orElse(null) as Long?) + /** The products to request access to (optional for reauthentication) */ - fun products(products: List) = apply { - this.products.clear() - this.products.addAll(products) - } + fun products(products: List?) = apply { body.products(products) } /** The products to request access to (optional for reauthentication) */ - fun addProduct(product: ConnectProducts) = apply { this.products.add(product) } + fun products(products: Optional>) = products(products.orElse(null)) + + /** The products to request access to (optional for reauthentication) */ + fun addProduct(product: ConnectProducts) = apply { body.addProduct(product) } + + /** The URI to redirect to after the Connect flow is completed */ + fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) } /** The URI to redirect to after the Connect flow is completed */ - fun redirectUri(redirectUri: String) = apply { this.redirectUri = redirectUri } + fun redirectUri(redirectUri: Optional) = redirectUri(redirectUri.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -330,36 +361,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): ConnectSessionReauthenticateParams = ConnectSessionReauthenticateParams( - checkNotNull(connectionId) { "`connectionId` is required but was not set" }, - minutesToExpire, - products.toImmutable().ifEmpty { null }, - redirectUri, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -461,11 +485,11 @@ constructor( return true } - return /* spotless:off */ other is ConnectSessionReauthenticateParams && connectionId == other.connectionId && minutesToExpire == other.minutesToExpire && products == other.products && redirectUri == other.redirectUri && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ConnectSessionReauthenticateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(connectionId, minutesToExpire, products, redirectUri, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ConnectSessionReauthenticateParams{connectionId=$connectionId, minutesToExpire=$minutesToExpire, products=$products, redirectUri=$redirectUri, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "ConnectSessionReauthenticateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 0cf71949..45a15e15 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -6,43 +6,50 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ConnectionCreateResponse.Builder::class) @NoAutoDetect class ConnectionCreateResponse +@JsonCreator private constructor( - private val connectionId: JsonField, - 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 tokenType: JsonField, - private val additionalProperties: Map, + @JsonProperty("access_token") + @ExcludeMissing + private val accessToken: JsonField = JsonMissing.of(), + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_type") + @ExcludeMissing + private val authenticationType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + private val providerId: JsonField = JsonMissing.of(), + @JsonProperty("token_type") + @ExcludeMissing + private val tokenType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The ID of the new connection */ - fun connectionId(): String = connectionId.getRequired("connection_id") - - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - fun companyId(): String = companyId.getRequired("company_id") - - /** The ID of the provider associated with the `access_token`. */ - fun providerId(): String = providerId.getRequired("provider_id") + fun accessToken(): String = accessToken.getRequired("access_token") /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun accountId(): String = accountId.getRequired("account_id") @@ -50,20 +57,20 @@ private constructor( fun authenticationType(): AuthenticationType = authenticationType.getRequired("authentication_type") - fun products(): List = products.getRequired("products") - - fun accessToken(): String = accessToken.getRequired("access_token") - - fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + fun companyId(): String = companyId.getRequired("company_id") /** The ID of the new connection */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun connectionId(): String = connectionId.getRequired("connection_id") - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + fun products(): List = products.getRequired("products") /** The ID of the provider associated with the `access_token`. */ - @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId + fun providerId(): String = providerId.getRequired("provider_id") + + fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) + + @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId @@ -72,9 +79,16 @@ private constructor( @ExcludeMissing fun _authenticationType() = authenticationType + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + + /** The ID of the new connection */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + @JsonProperty("products") @ExcludeMissing fun _products() = products - @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken + /** The ID of the provider associated with the `access_token`. */ + @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId @JsonProperty("token_type") @ExcludeMissing fun _tokenType() = tokenType @@ -82,15 +96,17 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ConnectionCreateResponse = apply { if (!validated) { - connectionId() - companyId() - providerId() + accessToken() accountId() authenticationType() + companyId() + connectionId() products() - accessToken() + providerId() tokenType() validated = true } @@ -105,113 +121,102 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() - private var providerId: JsonField = JsonMissing.of() + private var accessToken: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() private var authenticationType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var products: JsonField> = JsonMissing.of() - private var accessToken: JsonField = JsonMissing.of() + private var providerId: JsonField = JsonMissing.of() private var tokenType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectionCreateResponse: ConnectionCreateResponse) = apply { - this.connectionId = connectionCreateResponse.connectionId - this.companyId = connectionCreateResponse.companyId - this.providerId = connectionCreateResponse.providerId - this.accountId = connectionCreateResponse.accountId - this.authenticationType = connectionCreateResponse.authenticationType - this.products = connectionCreateResponse.products - this.accessToken = connectionCreateResponse.accessToken - this.tokenType = connectionCreateResponse.tokenType - additionalProperties(connectionCreateResponse.additionalProperties) + accessToken = connectionCreateResponse.accessToken + accountId = connectionCreateResponse.accountId + authenticationType = connectionCreateResponse.authenticationType + companyId = connectionCreateResponse.companyId + connectionId = connectionCreateResponse.connectionId + products = connectionCreateResponse.products + providerId = connectionCreateResponse.providerId + tokenType = connectionCreateResponse.tokenType + additionalProperties = connectionCreateResponse.additionalProperties.toMutableMap() } - /** The ID of the new connection */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** The ID of the new connection */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId - } - - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - - /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - - /** The ID of the provider associated with the `access_token`. */ - fun providerId(providerId: String) = providerId(JsonField.of(providerId)) + fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) - /** The ID of the provider associated with the `access_token`. */ - @JsonProperty("provider_id") - @ExcludeMissing - fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ - @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 } + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + /** [DEPRECATED] Use `connection_id` to associate a connection with an access token */ + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** The ID of the new connection */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + + /** The ID of the new connection */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } + 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)) + /** The ID of the provider associated with the `access_token`. */ + fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - @JsonProperty("access_token") - @ExcludeMissing - fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } + /** The ID of the provider associated with the `access_token`. */ + fun providerId(providerId: JsonField) = apply { this.providerId = providerId } fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType)) - @JsonProperty("token_type") - @ExcludeMissing fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ConnectionCreateResponse = ConnectionCreateResponse( - connectionId, - companyId, - providerId, + accessToken, accountId, authenticationType, + companyId, + connectionId, products.map { it.toImmutable() }, - accessToken, + providerId, tokenType, additionalProperties.toImmutable(), ) @@ -291,15 +296,15 @@ private constructor( return true } - return /* spotless:off */ other is ConnectionCreateResponse && connectionId == other.connectionId && companyId == other.companyId && providerId == other.providerId && accountId == other.accountId && authenticationType == other.authenticationType && products == other.products && accessToken == other.accessToken && tokenType == other.tokenType && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ConnectionCreateResponse && accessToken == other.accessToken && accountId == other.accountId && authenticationType == other.authenticationType && companyId == other.companyId && connectionId == other.connectionId && products == other.products && providerId == other.providerId && tokenType == other.tokenType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, providerId, accountId, authenticationType, products, accessToken, tokenType, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accessToken, accountId, authenticationType, companyId, connectionId, products, providerId, tokenType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ConnectionCreateResponse{connectionId=$connectionId, companyId=$companyId, providerId=$providerId, accountId=$accountId, authenticationType=$authenticationType, products=$products, accessToken=$accessToken, tokenType=$tokenType, additionalProperties=$additionalProperties}" + "ConnectionCreateResponse{accessToken=$accessToken, accountId=$accountId, authenticationType=$authenticationType, companyId=$companyId, connectionId=$connectionId, products=$products, providerId=$providerId, tokenType=$tokenType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index e9d348c3..95b4087a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -6,52 +6,58 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = CreateAccessTokenResponse.Builder::class) @NoAutoDetect class CreateAccessTokenResponse +@JsonCreator private constructor( - private val accessToken: JsonField, - private val tokenType: JsonField, - private val connectionId: JsonField, - private val customerId: JsonField, - private val accountId: JsonField, - private val clientType: JsonField, - private val companyId: JsonField, - private val connectionType: JsonField, - private val products: JsonField>, - private val providerId: JsonField, - private val additionalProperties: Map, + @JsonProperty("access_token") + @ExcludeMissing + private val accessToken: JsonField = JsonMissing.of(), + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("client_type") + @ExcludeMissing + private val clientType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("connection_type") + @ExcludeMissing + private val connectionType: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + private val providerId: JsonField = JsonMissing.of(), + @JsonProperty("customer_id") + @ExcludeMissing + private val customerId: JsonField = JsonMissing.of(), + @JsonProperty("token_type") + @ExcludeMissing + private val tokenType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The access token for the connection. */ fun accessToken(): String = accessToken.getRequired("access_token") - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ - fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) - - /** The Finch UUID of the connection associated with the `access_token`. */ - fun connectionId(): String = connectionId.getRequired("connection_id") - - /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. - */ - fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) - /** [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. */ fun accountId(): String = accountId.getRequired("account_id") @@ -61,6 +67,9 @@ private constructor( /** [DEPRECATED] Use `connection_id` to identify the connection instead of this company ID. */ fun companyId(): String = companyId.getRequired("company_id") + /** The Finch UUID of the connection associated with the `access_token`. */ + fun connectionId(): String = connectionId.getRequired("connection_id") + /** * The type of the connection associated with the token. * - `provider` - connection to an external provider @@ -74,20 +83,17 @@ private constructor( /** The ID of the provider associated with the `access_token`. */ fun providerId(): String = providerId.getRequired("provider_id") - /** The access token for the connection. */ - @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken - - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ - @JsonProperty("token_type") @ExcludeMissing fun _tokenType() = tokenType - - /** The Finch UUID of the connection associated with the `access_token`. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId - /** * The ID of your customer you provided to Finch when a connect session was created for this * connection. */ - @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + fun customerId(): Optional = Optional.ofNullable(customerId.getNullable("customer_id")) + + /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + fun tokenType(): Optional = Optional.ofNullable(tokenType.getNullable("token_type")) + + /** The access token for the connection. */ + @JsonProperty("access_token") @ExcludeMissing fun _accessToken() = accessToken /** [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. */ @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId @@ -98,6 +104,9 @@ private constructor( /** [DEPRECATED] Use `connection_id` to identify the connection instead of this company ID. */ @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + /** The Finch UUID of the connection associated with the `access_token`. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + /** * The type of the connection associated with the token. * - `provider` - connection to an external provider @@ -111,22 +120,33 @@ private constructor( /** The ID of the provider associated with the `access_token`. */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId + /** + * The ID of your customer you provided to Finch when a connect session was created for this + * connection. + */ + @JsonProperty("customer_id") @ExcludeMissing fun _customerId() = customerId + + /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + @JsonProperty("token_type") @ExcludeMissing fun _tokenType() = tokenType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): CreateAccessTokenResponse = apply { if (!validated) { accessToken() - tokenType() - connectionId() - customerId() accountId() clientType() companyId() + connectionId() connectionType() products() providerId() + customerId() + tokenType() validated = true } } @@ -141,72 +161,38 @@ private constructor( class Builder { private var accessToken: JsonField = JsonMissing.of() - private var tokenType: JsonField = JsonMissing.of() - private var connectionId: JsonField = JsonMissing.of() - private var customerId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() private var clientType: JsonField = JsonMissing.of() private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var connectionType: JsonField = JsonMissing.of() private var products: JsonField> = JsonMissing.of() private var providerId: JsonField = JsonMissing.of() + private var customerId: JsonField = JsonMissing.of() + private var tokenType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(createAccessTokenResponse: CreateAccessTokenResponse) = apply { - this.accessToken = createAccessTokenResponse.accessToken - this.tokenType = createAccessTokenResponse.tokenType - this.connectionId = createAccessTokenResponse.connectionId - this.customerId = createAccessTokenResponse.customerId - this.accountId = createAccessTokenResponse.accountId - this.clientType = createAccessTokenResponse.clientType - this.companyId = createAccessTokenResponse.companyId - this.connectionType = createAccessTokenResponse.connectionType - this.products = createAccessTokenResponse.products - this.providerId = createAccessTokenResponse.providerId - additionalProperties(createAccessTokenResponse.additionalProperties) + accessToken = createAccessTokenResponse.accessToken + accountId = createAccessTokenResponse.accountId + clientType = createAccessTokenResponse.clientType + companyId = createAccessTokenResponse.companyId + connectionId = createAccessTokenResponse.connectionId + connectionType = createAccessTokenResponse.connectionType + products = createAccessTokenResponse.products + providerId = createAccessTokenResponse.providerId + customerId = createAccessTokenResponse.customerId + tokenType = createAccessTokenResponse.tokenType + additionalProperties = createAccessTokenResponse.additionalProperties.toMutableMap() } /** The access token for the connection. */ fun accessToken(accessToken: String) = accessToken(JsonField.of(accessToken)) /** The access token for the connection. */ - @JsonProperty("access_token") - @ExcludeMissing fun accessToken(accessToken: JsonField) = apply { this.accessToken = accessToken } - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ - fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType)) - - /** The RFC 8693 token type (Finch uses `bearer` tokens) */ - @JsonProperty("token_type") - @ExcludeMissing - fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType } - - /** The Finch UUID of the connection associated with the `access_token`. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** The Finch UUID of the connection associated with the `access_token`. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId - } - - /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. - */ - fun customerId(customerId: String) = customerId(JsonField.of(customerId)) - - /** - * The ID of your customer you provided to Finch when a connect session was created for this - * connection. - */ - @JsonProperty("customer_id") - @ExcludeMissing - fun customerId(customerId: JsonField) = apply { this.customerId = customerId } - /** * [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. */ @@ -215,16 +201,12 @@ private constructor( /** * [DEPRECATED] Use `connection_id` to identify the connection instead of this account ID. */ - @JsonProperty("account_id") - @ExcludeMissing fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** The type of application associated with a token. */ fun clientType(clientType: ClientType) = clientType(JsonField.of(clientType)) /** The type of application associated with a token. */ - @JsonProperty("client_type") - @ExcludeMissing fun clientType(clientType: JsonField) = apply { this.clientType = clientType } /** @@ -235,10 +217,16 @@ private constructor( /** * [DEPRECATED] Use `connection_id` to identify the connection instead of this company ID. */ - @JsonProperty("company_id") - @ExcludeMissing fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + /** The Finch UUID of the connection associated with the `access_token`. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + + /** The Finch UUID of the connection associated with the `access_token`. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } + /** * The type of the connection associated with the token. * - `provider` - connection to an external provider @@ -252,8 +240,6 @@ private constructor( * - `provider` - connection to an external provider * - `finch` - finch-generated data. */ - @JsonProperty("connection_type") - @ExcludeMissing fun connectionType(connectionType: JsonField) = apply { this.connectionType = connectionType } @@ -262,44 +248,63 @@ private constructor( fun products(products: List) = products(JsonField.of(products)) /** An array of the authorized products associated with the `access_token`. */ - @JsonProperty("products") - @ExcludeMissing fun products(products: JsonField>) = apply { this.products = products } /** The ID of the provider associated with the `access_token`. */ fun providerId(providerId: String) = providerId(JsonField.of(providerId)) /** The ID of the provider associated with the `access_token`. */ - @JsonProperty("provider_id") - @ExcludeMissing fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + /** + * The ID of your customer you provided to Finch when a connect session was created for this + * connection. + */ + fun customerId(customerId: String) = customerId(JsonField.of(customerId)) + + /** + * The ID of your customer you provided to Finch when a connect session was created for this + * connection. + */ + fun customerId(customerId: JsonField) = apply { this.customerId = customerId } + + /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + fun tokenType(tokenType: String) = tokenType(JsonField.of(tokenType)) + + /** The RFC 8693 token type (Finch uses `bearer` tokens) */ + fun tokenType(tokenType: JsonField) = apply { this.tokenType = tokenType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CreateAccessTokenResponse = CreateAccessTokenResponse( accessToken, - tokenType, - connectionId, - customerId, accountId, clientType, companyId, + connectionId, connectionType, products.map { it.toImmutable() }, providerId, + customerId, + tokenType, additionalProperties.toImmutable(), ) } @@ -429,15 +434,15 @@ private constructor( return true } - return /* spotless:off */ other is CreateAccessTokenResponse && accessToken == other.accessToken && tokenType == other.tokenType && connectionId == other.connectionId && customerId == other.customerId && accountId == other.accountId && clientType == other.clientType && companyId == other.companyId && connectionType == other.connectionType && products == other.products && providerId == other.providerId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CreateAccessTokenResponse && accessToken == other.accessToken && accountId == other.accountId && clientType == other.clientType && companyId == other.companyId && connectionId == other.connectionId && connectionType == other.connectionType && products == other.products && providerId == other.providerId && customerId == other.customerId && tokenType == other.tokenType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(accessToken, tokenType, connectionId, customerId, accountId, clientType, companyId, connectionType, products, providerId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accessToken, accountId, clientType, companyId, connectionId, connectionType, products, providerId, customerId, tokenType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "CreateAccessTokenResponse{accessToken=$accessToken, tokenType=$tokenType, connectionId=$connectionId, customerId=$customerId, accountId=$accountId, clientType=$clientType, companyId=$companyId, connectionType=$connectionType, products=$products, providerId=$providerId, additionalProperties=$additionalProperties}" + "CreateAccessTokenResponse{accessToken=$accessToken, accountId=$accountId, clientType=$clientType, companyId=$companyId, connectionId=$connectionId, connectionType=$connectionType, products=$products, providerId=$providerId, customerId=$customerId, tokenType=$tokenType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt index 9358a950..88528a19 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt @@ -4,26 +4,27 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = CreateCompanyBenefitsResponse.Builder::class) @NoAutoDetect class CreateCompanyBenefitsResponse +@JsonCreator private constructor( - private val benefitId: JsonField, - private val additionalProperties: Map, + @JsonProperty("benefit_id") + @ExcludeMissing + private val benefitId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun benefitId(): String = benefitId.getRequired("benefit_id") @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId() = benefitId @@ -32,6 +33,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): CreateCompanyBenefitsResponse = apply { if (!validated) { benefitId() @@ -53,30 +56,33 @@ private constructor( @JvmSynthetic internal fun from(createCompanyBenefitsResponse: CreateCompanyBenefitsResponse) = apply { - this.benefitId = createCompanyBenefitsResponse.benefitId - additionalProperties(createCompanyBenefitsResponse.additionalProperties) + benefitId = createCompanyBenefitsResponse.benefitId + additionalProperties = createCompanyBenefitsResponse.additionalProperties.toMutableMap() } fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) - @JsonProperty("benefit_id") - @ExcludeMissing fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CreateCompanyBenefitsResponse = CreateCompanyBenefitsResponse(benefitId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index 910a494f..4790f6c0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = DirectoryEvent.Builder::class) @NoAutoDetect class DirectoryEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): DirectoryEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,108 +110,104 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(directoryEvent: DirectoryEvent) = apply { - this.connectionId = directoryEvent.connectionId - this.companyId = directoryEvent.companyId - this.accountId = directoryEvent.accountId - this.eventType = directoryEvent.eventType - this.data = directoryEvent.data - additionalProperties(directoryEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = directoryEvent.accountId + companyId = directoryEvent.companyId + connectionId = directoryEvent.connectionId + data = directoryEvent.data + eventType = directoryEvent.eventType + additionalProperties = directoryEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): DirectoryEvent = DirectoryEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val individualId: JsonField, - private val additionalProperties: Map, + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The ID of the individual related to the event. */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) @@ -215,6 +219,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { individualId() @@ -236,34 +242,37 @@ private constructor( @JvmSynthetic internal fun from(data: Data) = apply { - this.individualId = data.individualId - additionalProperties(data.additionalProperties) + individualId = data.individualId + additionalProperties = data.additionalProperties.toMutableMap() } /** The ID of the individual related to the event. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** The ID of the individual related to the event. */ - @JsonProperty("individual_id") - @ExcludeMissing fun individualId(individualId: JsonField) = apply { this.individualId = individualId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data(individualId, additionalProperties.toImmutable()) } @@ -353,15 +362,15 @@ private constructor( return true } - return /* spotless:off */ other is DirectoryEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is DirectoryEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "DirectoryEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "DirectoryEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt index 7485b444..17507790 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DisconnectResponse.kt @@ -4,26 +4,27 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = DisconnectResponse.Builder::class) @NoAutoDetect class DisconnectResponse +@JsonCreator private constructor( - private val status: JsonField, - private val additionalProperties: Map, + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** If the request is successful, Finch will return “success” (HTTP 200 status). */ fun status(): String = status.getRequired("status") @@ -34,6 +35,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): DisconnectResponse = apply { if (!validated) { status() @@ -55,32 +58,35 @@ private constructor( @JvmSynthetic internal fun from(disconnectResponse: DisconnectResponse) = apply { - this.status = disconnectResponse.status - additionalProperties(disconnectResponse.additionalProperties) + status = disconnectResponse.status + additionalProperties = disconnectResponse.additionalProperties.toMutableMap() } /** If the request is successful, Finch will return “success” (HTTP 200 status). */ fun status(status: String) = status(JsonField.of(status)) /** If the request is successful, Finch will return “success” (HTTP 200 status). */ - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): DisconnectResponse = DisconnectResponse(status, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt index 13b45119..9bff5116 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt @@ -6,64 +6,93 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = EmploymentData.Builder::class) @NoAutoDetect class EmploymentData +@JsonCreator private constructor( - private val id: JsonField, - 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 latestRehireDate: JsonField, - private val isActive: JsonField, - private val employmentStatus: 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 workId: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") + @ExcludeMissing + private val classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + private val customFields: JsonField> = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + private val employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + private val employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") + @ExcludeMissing + private val income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + private val incomeHistory: JsonField> = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("latest_rehire_date") + @ExcludeMissing + private val latestRehireDate: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + private val location: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("source_id") + @ExcludeMissing + private val sourceId: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing private val title: JsonField = JsonMissing.of(), + @JsonProperty("work_id") + @ExcludeMissing + private val workId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** string 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. */ - 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")) + /** Worker's compensation classification code for this employee */ + fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) - /** The manager object representing the manager of the individual within the org. */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + /** + * Custom fields for the individual. These are fields which are defined by the employer in the + * system. + */ + fun customFields(): Optional> = + Optional.ofNullable(customFields.getNullable("custom_fields")) /** The department object. */ fun department(): Optional = @@ -73,16 +102,6 @@ private constructor( 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")) - - fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) - - /** `true` if the individual an an active employee or contractor at the company. */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** * The detailed employment status of the individual. Available options: `active`, `deceased`, * `leave`, `onboarding`, `prehire`, `retired`, `terminated`. @@ -90,10 +109,10 @@ private constructor( fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) - /** Worker's compensation classification code for this employee */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + /** The legal first name of the individual. */ + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) /** * The employee's income as reported by the provider. This may not always be annualized income, @@ -106,36 +125,45 @@ private constructor( 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. - */ - fun customFields(): Optional> = - Optional.ofNullable(customFields.getNullable("custom_fields")) + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + + /** The legal last name of the individual. */ + fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) + + fun latestRehireDate(): Optional = + Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) + + fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + + /** The legal middle name of the individual. */ + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) /** The source system's unique employment identifier for this individual */ fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) + + /** The current title of the individual. */ + fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + /** This field is deprecated in favour of `source_id` */ fun workId(): Optional = Optional.ofNullable(workId.getNullable("work_id")) /** string A stable Finch `id` (UUID v4) for an individual in the company. */ @JsonProperty("id") @ExcludeMissing fun _id() = 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 + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode - /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + /** + * Custom fields for the individual. These are fields which are defined by the employer in the + * system. + */ + @JsonProperty("custom_fields") @ExcludeMissing fun _customFields() = customFields /** The department object. */ @JsonProperty("department") @ExcludeMissing fun _department() = department @@ -143,25 +171,16 @@ private constructor( /** The employment object. */ @JsonProperty("employment") @ExcludeMissing fun _employment() = employment - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - - @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate() = latestRehireDate - - /** `true` if the individual an an active employee or contractor at the company. */ - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - /** * The detailed employment status of the individual. Available options: `active`, `deceased`, * `leave`, `onboarding`, `prehire`, `retired`, `terminated`. */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus() = employmentStatus - /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("location") @ExcludeMissing fun _location() = location + /** The legal first name of the individual. */ + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName /** * The employee's income as reported by the provider. This may not always be annualized income, @@ -173,15 +192,30 @@ private constructor( /** 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. - */ - @JsonProperty("custom_fields") @ExcludeMissing fun _customFields() = customFields + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + + /** The legal last name of the individual. */ + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + + @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate() = latestRehireDate + + @JsonProperty("location") @ExcludeMissing fun _location() = location + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName /** The source system's unique employment identifier for this individual */ @JsonProperty("source_id") @ExcludeMissing fun _sourceId() = sourceId + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** The current title of the individual. */ + @JsonProperty("title") @ExcludeMissing fun _title() = title + /** This field is deprecated in favour of `source_id` */ @JsonProperty("work_id") @ExcludeMissing fun _workId() = workId @@ -189,27 +223,29 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmploymentData = apply { if (!validated) { id() - firstName() - middleName() - lastName() - title() - manager().map { it.validate() } + classCode() + customFields().map { it.forEach { it.validate() } } department().map { it.validate() } employment().map { it.validate() } - startDate() - endDate() - latestRehireDate() - isActive() employmentStatus() - classCode() - location().map { it.validate() } + endDate() + firstName() income().map { it.validate() } incomeHistory().map { it.forEach { it?.validate() } } - customFields().map { it.forEach { it.validate() } } + isActive() + lastName() + latestRehireDate() + location().map { it.validate() } + manager().map { it.validate() } + middleName() sourceId() + startDate() + title() workId() validated = true } @@ -225,143 +261,90 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 classCode: JsonField = JsonMissing.of() + private var customFields: 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 latestRehireDate: JsonField = JsonMissing.of() - private var isActive: JsonField = JsonMissing.of() private var employmentStatus: JsonField = JsonMissing.of() - private var classCode: JsonField = JsonMissing.of() - private var location: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() private var income: JsonField = JsonMissing.of() private var incomeHistory: JsonField> = JsonMissing.of() - private var customFields: JsonField> = JsonMissing.of() + private var isActive: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var latestRehireDate: JsonField = JsonMissing.of() + private var location: JsonField = JsonMissing.of() + private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var sourceId: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var title: JsonField = JsonMissing.of() private var workId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employmentData: EmploymentData) = apply { - this.id = employmentData.id - this.firstName = employmentData.firstName - this.middleName = employmentData.middleName - this.lastName = employmentData.lastName - this.title = employmentData.title - this.manager = employmentData.manager - this.department = employmentData.department - this.employment = employmentData.employment - this.startDate = employmentData.startDate - this.endDate = employmentData.endDate - this.latestRehireDate = employmentData.latestRehireDate - this.isActive = employmentData.isActive - this.employmentStatus = employmentData.employmentStatus - this.classCode = employmentData.classCode - this.location = employmentData.location - this.income = employmentData.income - this.incomeHistory = employmentData.incomeHistory - this.customFields = employmentData.customFields - this.sourceId = employmentData.sourceId - this.workId = employmentData.workId - additionalProperties(employmentData.additionalProperties) + id = employmentData.id + classCode = employmentData.classCode + customFields = employmentData.customFields + department = employmentData.department + employment = employmentData.employment + employmentStatus = employmentData.employmentStatus + endDate = employmentData.endDate + firstName = employmentData.firstName + income = employmentData.income + incomeHistory = employmentData.incomeHistory + isActive = employmentData.isActive + lastName = employmentData.lastName + latestRehireDate = employmentData.latestRehireDate + location = employmentData.location + manager = employmentData.manager + middleName = employmentData.middleName + sourceId = employmentData.sourceId + startDate = employmentData.startDate + title = employmentData.title + workId = employmentData.workId + additionalProperties = employmentData.additionalProperties.toMutableMap() } /** string A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(id: String) = id(JsonField.of(id)) /** string A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - - /** 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)) + fun id(id: JsonField) = apply { this.id = id } - /** 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)) + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String) = classCode(JsonField.of(classCode)) - /** The current title of the individual. */ - @JsonProperty("title") - @ExcludeMissing - fun title(title: JsonField) = apply { this.title = title } + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: JsonField) = apply { this.classCode = classCode } - /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Manager) = manager(JsonField.of(manager)) + /** + * Custom fields for the individual. These are fields which are defined by the employer in + * the system. + */ + fun customFields(customFields: List) = customFields(JsonField.of(customFields)) - /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") - @ExcludeMissing - fun manager(manager: JsonField) = apply { this.manager = manager } + /** + * Custom fields for the individual. These are fields which are defined by the employer in + * the system. + */ + fun customFields(customFields: JsonField>) = apply { + this.customFields = customFields + } /** 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 } - - fun latestRehireDate(latestRehireDate: String) = - latestRehireDate(JsonField.of(latestRehireDate)) - - @JsonProperty("latest_rehire_date") - @ExcludeMissing - fun latestRehireDate(latestRehireDate: JsonField) = apply { - this.latestRehireDate = latestRehireDate - } - - /** `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 } - /** * The detailed employment status of the individual. Available options: `active`, * `deceased`, `leave`, `onboarding`, `prehire`, `retired`, `terminated`. @@ -373,25 +356,19 @@ private constructor( * The detailed employment status of the individual. Available options: `active`, * `deceased`, `leave`, `onboarding`, `prehire`, `retired`, `terminated`. */ - @JsonProperty("employment_status") - @ExcludeMissing fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } - /** Worker's compensation classification code for this employee */ - fun classCode(classCode: String) = classCode(JsonField.of(classCode)) + fun endDate(endDate: String) = endDate(JsonField.of(endDate)) - /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") - @ExcludeMissing - fun classCode(classCode: JsonField) = apply { this.classCode = classCode } + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun location(location: Location) = location(JsonField.of(location)) + /** The legal first name of the individual. */ + fun firstName(firstName: String) = firstName(JsonField.of(firstName)) - @JsonProperty("location") - @ExcludeMissing - fun location(location: JsonField) = apply { this.location = location } + /** The legal first name of the individual. */ + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** * The employee's income as reported by the provider. This may not always be annualized @@ -405,103 +382,130 @@ private constructor( * 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. - */ - fun customFields(customFields: List) = customFields(JsonField.of(customFields)) + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - /** - * Custom fields for the individual. These are fields which are defined by the employer in - * the system. - */ - @JsonProperty("custom_fields") - @ExcludeMissing - fun customFields(customFields: JsonField>) = apply { - this.customFields = customFields + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + + /** The legal last name of the individual. */ + fun lastName(lastName: String) = lastName(JsonField.of(lastName)) + + /** The legal last name of the individual. */ + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + + fun latestRehireDate(latestRehireDate: String) = + latestRehireDate(JsonField.of(latestRehireDate)) + + fun latestRehireDate(latestRehireDate: JsonField) = apply { + this.latestRehireDate = latestRehireDate } + fun location(location: Location) = location(JsonField.of(location)) + + fun location(location: JsonField) = apply { this.location = location } + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager) = manager(JsonField.of(manager)) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: JsonField) = apply { this.manager = manager } + + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) + + /** The legal middle name of the individual. */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) /** The source system's unique employment identifier for this individual */ - @JsonProperty("source_id") - @ExcludeMissing fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } + fun startDate(startDate: String) = startDate(JsonField.of(startDate)) + + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + + /** The current title of the individual. */ + fun title(title: String) = title(JsonField.of(title)) + + /** The current title of the individual. */ + fun title(title: JsonField) = apply { this.title = title } + /** This field is deprecated in favour of `source_id` */ fun workId(workId: String) = workId(JsonField.of(workId)) /** This field is deprecated in favour of `source_id` */ - @JsonProperty("work_id") - @ExcludeMissing fun workId(workId: JsonField) = apply { this.workId = workId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmploymentData = EmploymentData( id, - firstName, - middleName, - lastName, - title, - manager, + classCode, + customFields.map { it.toImmutable() }, department, employment, - startDate, - endDate, - latestRehireDate, - isActive, employmentStatus, - classCode, - location, + endDate, + firstName, income, incomeHistory.map { it.toImmutable() }, - customFields.map { it.toImmutable() }, + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, sourceId, + startDate, + title, workId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = CustomField.Builder::class) @NoAutoDetect class CustomField + @JsonCreator private constructor( - private val name: JsonField, - private val value: JsonValue, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing private val value: JsonValue = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("name") @ExcludeMissing fun _name() = name @@ -512,6 +516,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): CustomField = apply { if (!validated) { name() @@ -534,35 +540,36 @@ private constructor( @JvmSynthetic internal fun from(customField: CustomField) = apply { - this.name = customField.name - this.value = customField.value - additionalProperties(customField.additionalProperties) + name = customField.name + value = customField.value + additionalProperties = customField.additionalProperties.toMutableMap() } 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CustomField = CustomField( name, @@ -590,16 +597,17 @@ private constructor( } /** The department object. */ - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The name of the department associated with the individual. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -610,6 +618,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -631,32 +641,35 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = department.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -679,20 +692,18 @@ private constructor( } /** The employment object. */ - @JsonDeserialize(builder = Employment.Builder::class) @NoAutoDetect class Employment + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** 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`. @@ -700,7 +711,7 @@ private constructor( fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) /** The main employment type of the individual. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, @@ -708,14 +719,19 @@ private constructor( */ @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + /** The main employment type of the individual. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Employment = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -729,25 +745,17 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = employment.subtype + type = employment.type + additionalProperties = employment.additionalProperties.toMutableMap() } - /** 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`. @@ -758,28 +766,37 @@ private constructor( * 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 } + /** The main employment type of the individual. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The main employment type of the individual. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Employment = Employment( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -927,17 +944,17 @@ private constructor( return true } - return /* spotless:off */ other is Employment && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Employment && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } class EmploymentStatus @@ -1028,16 +1045,15 @@ private constructor( } /** The manager object representing the manager of the individual within the org. */ - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -1048,6 +1064,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -1069,32 +1087,35 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -1120,15 +1141,15 @@ private constructor( return true } - return /* spotless:off */ other is EmploymentData && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && title == other.title && manager == other.manager && department == other.department && employment == other.employment && startDate == other.startDate && endDate == other.endDate && latestRehireDate == other.latestRehireDate && isActive == other.isActive && employmentStatus == other.employmentStatus && classCode == other.classCode && location == other.location && income == other.income && incomeHistory == other.incomeHistory && customFields == other.customFields && sourceId == other.sourceId && workId == other.workId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmploymentData && id == other.id && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && workId == other.workId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, title, manager, department, employment, startDate, endDate, latestRehireDate, isActive, employmentStatus, classCode, location, income, incomeHistory, customFields, sourceId, workId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, sourceId, startDate, title, workId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmploymentData{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, title=$title, manager=$manager, department=$department, employment=$employment, startDate=$startDate, endDate=$endDate, latestRehireDate=$latestRehireDate, isActive=$isActive, employmentStatus=$employmentStatus, classCode=$classCode, location=$location, income=$income, incomeHistory=$incomeHistory, customFields=$customFields, sourceId=$sourceId, workId=$workId, additionalProperties=$additionalProperties}" + "EmploymentData{id=$id, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, workId=$workId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 9b7bbd53..dd49c42f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -4,51 +4,56 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = EmploymentDataResponse.Builder::class) @NoAutoDetect class EmploymentDataResponse +@JsonCreator private constructor( - private val individualId: JsonField, - private val code: JsonField, - private val body: JsonField, - private val additionalProperties: Map, + @JsonProperty("body") + @ExcludeMissing + private val body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun body(): Optional = Optional.ofNullable(body.getNullable("body")) fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + @JsonProperty("body") @ExcludeMissing fun _body() = body @JsonProperty("code") @ExcludeMissing fun _code() = code - @JsonProperty("body") @ExcludeMissing fun _body() = body + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmploymentDataResponse = apply { if (!validated) { - individualId() - code() body().map { it.validate() } + code() + individualId() validated = true } } @@ -62,58 +67,57 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() private var body: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employmentDataResponse: EmploymentDataResponse) = apply { - this.individualId = employmentDataResponse.individualId - this.code = employmentDataResponse.code - this.body = employmentDataResponse.body - additionalProperties(employmentDataResponse.additionalProperties) + body = employmentDataResponse.body + code = employmentDataResponse.code + individualId = employmentDataResponse.individualId + additionalProperties = employmentDataResponse.additionalProperties.toMutableMap() } - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + fun body(body: EmploymentData) = body(JsonField.of(body)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId - } + fun body(body: JsonField) = apply { this.body = body } fun code(code: Long) = code(JsonField.of(code)) - @JsonProperty("code") - @ExcludeMissing fun code(code: JsonField) = apply { this.code = code } - fun body(body: EmploymentData) = body(JsonField.of(body)) + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField) = apply { this.body = body } + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmploymentDataResponse = EmploymentDataResponse( - individualId, - code, body, + code, + individualId, additionalProperties.toImmutable(), ) } @@ -123,15 +127,15 @@ private constructor( return true } - return /* spotless:off */ other is EmploymentDataResponse && individualId == other.individualId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmploymentDataResponse && body == other.body && code == other.code && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, code, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, code, individualId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmploymentDataResponse{individualId=$individualId, code=$code, body=$body, additionalProperties=$additionalProperties}" + "EmploymentDataResponse{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index b81081b9..fa684380 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = EmploymentEvent.Builder::class) @NoAutoDetect class EmploymentEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): EmploymentEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,108 +110,104 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employmentEvent: EmploymentEvent) = apply { - this.connectionId = employmentEvent.connectionId - this.companyId = employmentEvent.companyId - this.accountId = employmentEvent.accountId - this.eventType = employmentEvent.eventType - this.data = employmentEvent.data - additionalProperties(employmentEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = employmentEvent.accountId + companyId = employmentEvent.companyId + connectionId = employmentEvent.connectionId + data = employmentEvent.data + eventType = employmentEvent.eventType + additionalProperties = employmentEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmploymentEvent = EmploymentEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val individualId: JsonField, - private val additionalProperties: Map, + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The ID of the individual related to the event. */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) @@ -215,6 +219,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { individualId() @@ -236,34 +242,37 @@ private constructor( @JvmSynthetic internal fun from(data: Data) = apply { - this.individualId = data.individualId - additionalProperties(data.additionalProperties) + individualId = data.individualId + additionalProperties = data.additionalProperties.toMutableMap() } /** The ID of the individual related to the event. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** The ID of the individual related to the event. */ - @JsonProperty("individual_id") - @ExcludeMissing fun individualId(individualId: JsonField) = apply { this.individualId = individualId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data(individualId, additionalProperties.toImmutable()) } @@ -353,15 +362,15 @@ private constructor( return true } - return /* spotless:off */ other is EmploymentEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmploymentEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmploymentEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "EmploymentEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index 35be88e0..8ba37024 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -6,60 +6,90 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = EmploymentUpdateResponse.Builder::class) @NoAutoDetect class EmploymentUpdateResponse +@JsonCreator 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 latestRehireDate: JsonField, - private val isActive: JsonField, - private val employmentStatus: 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, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") + @ExcludeMissing + private val classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + private val customFields: JsonField> = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + private val employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + private val employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") + @ExcludeMissing + private val income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + private val incomeHistory: JsonField> = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("latest_rehire_date") + @ExcludeMissing + private val latestRehireDate: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + private val location: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("source_id") + @ExcludeMissing + private val sourceId: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") @ExcludeMissing private val title: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** 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")) + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** The current title of the individual. */ - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + /** Worker's compensation classification code for this employee */ + fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) - /** The manager object representing the manager of the individual within the org. */ - fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) + /** + * 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 department object. */ fun department(): Optional = @@ -69,24 +99,14 @@ private constructor( 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")) - - fun latestRehireDate(): Optional = - Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) - - /** `true` if the individual an an active employee or contractor at the company. */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The detailed employment status of the individual. */ fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus.getNullable("employment_status")) - /** Worker's compensation classification code for this employee */ - fun classCode(): Optional = Optional.ofNullable(classCode.getNullable("class_code")) + fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + /** The legal first name of the individual. */ + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) /** * The employee's income as reported by the provider. This may not always be annualized income, @@ -99,33 +119,42 @@ private constructor( 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")) + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - /** The source system's unique employment identifier for this individual */ - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + /** The legal last name of the individual. */ + fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun latestRehireDate(): Optional = + Optional.ofNullable(latestRehireDate.getNullable("latest_rehire_date")) - /** The legal first name of the individual. */ - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + fun location(): Optional = Optional.ofNullable(location.getNullable("location")) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) /** The legal middle name of the individual. */ - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) - /** The legal last name of the individual. */ - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + /** The source system's unique employment identifier for this individual */ + fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + + fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) /** The current title of the individual. */ - @JsonProperty("title") @ExcludeMissing fun _title() = title + fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") @ExcludeMissing fun _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") @ExcludeMissing fun _customFields() = customFields /** The department object. */ @JsonProperty("department") @ExcludeMissing fun _department() = department @@ -133,22 +162,13 @@ private constructor( /** The employment object. */ @JsonProperty("employment") @ExcludeMissing fun _employment() = employment - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - - @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate() = latestRehireDate - - /** `true` if the individual an an active employee or contractor at the company. */ - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - /** The detailed employment status of the individual. */ @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus() = employmentStatus - /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("location") @ExcludeMissing fun _location() = location + /** The legal first name of the individual. */ + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName /** * The employee's income as reported by the provider. This may not always be annualized income, @@ -160,43 +180,57 @@ private constructor( /** 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 + /** `true` if the individual an an active employee or contractor at the company. */ + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + + /** The legal last name of the individual. */ + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + + @JsonProperty("latest_rehire_date") @ExcludeMissing fun _latestRehireDate() = latestRehireDate + + @JsonProperty("location") @ExcludeMissing fun _location() = location + + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName /** 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 + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + /** The current title of the individual. */ + @JsonProperty("title") @ExcludeMissing fun _title() = title @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmploymentUpdateResponse = apply { if (!validated) { - firstName() - middleName() - lastName() - title() - manager().map { it.validate() } + id() + classCode() + customFields().map { it.forEach { it.validate() } } department().map { it.validate() } employment().map { it.validate() } - startDate() - endDate() - latestRehireDate() - isActive() employmentStatus() - classCode() - location().map { it.validate() } + endDate() + firstName() income().map { it.validate() } incomeHistory().map { it.forEach { it?.validate() } } - customFields().map { it.forEach { it.validate() } } + isActive() + lastName() + latestRehireDate() + location().map { it.validate() } + manager().map { it.validate() } + middleName() sourceId() - id() + startDate() + title() validated = true } } @@ -210,160 +244,107 @@ private constructor( 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 id: JsonField = JsonMissing.of() + private var classCode: JsonField = JsonMissing.of() + private var customFields: 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 latestRehireDate: JsonField = JsonMissing.of() - private var isActive: JsonField = JsonMissing.of() private var employmentStatus: JsonField = JsonMissing.of() - private var classCode: JsonField = JsonMissing.of() - private var location: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() private var income: JsonField = JsonMissing.of() private var incomeHistory: JsonField> = JsonMissing.of() - private var customFields: JsonField> = JsonMissing.of() + private var isActive: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var latestRehireDate: JsonField = JsonMissing.of() + private var location: JsonField = JsonMissing.of() + private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var sourceId: JsonField = JsonMissing.of() - private var id: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var title: 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.latestRehireDate = employmentUpdateResponse.latestRehireDate - this.isActive = employmentUpdateResponse.isActive - this.employmentStatus = employmentUpdateResponse.employmentStatus - 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) + id = employmentUpdateResponse.id + classCode = employmentUpdateResponse.classCode + customFields = employmentUpdateResponse.customFields + department = employmentUpdateResponse.department + employment = employmentUpdateResponse.employment + employmentStatus = employmentUpdateResponse.employmentStatus + endDate = employmentUpdateResponse.endDate + firstName = employmentUpdateResponse.firstName + income = employmentUpdateResponse.income + incomeHistory = employmentUpdateResponse.incomeHistory + isActive = employmentUpdateResponse.isActive + lastName = employmentUpdateResponse.lastName + latestRehireDate = employmentUpdateResponse.latestRehireDate + location = employmentUpdateResponse.location + manager = employmentUpdateResponse.manager + middleName = employmentUpdateResponse.middleName + sourceId = employmentUpdateResponse.sourceId + startDate = employmentUpdateResponse.startDate + title = employmentUpdateResponse.title + additionalProperties = employmentUpdateResponse.additionalProperties.toMutableMap() } - /** 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)) + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(id: String) = id(JsonField.of(id)) - /** The legal last name of the individual. */ - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(id: JsonField) = apply { this.id = id } - /** The current title of the individual. */ - fun title(title: String) = title(JsonField.of(title)) + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String) = classCode(JsonField.of(classCode)) - /** The current title of the individual. */ - @JsonProperty("title") - @ExcludeMissing - fun title(title: JsonField) = apply { this.title = title } + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: JsonField) = apply { this.classCode = classCode } - /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Manager) = manager(JsonField.of(manager)) + /** + * 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)) - /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") - @ExcludeMissing - fun manager(manager: JsonField) = apply { this.manager = manager } + /** + * 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: JsonField>) = apply { + this.customFields = customFields + } /** 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 } - - fun latestRehireDate(latestRehireDate: String) = - latestRehireDate(JsonField.of(latestRehireDate)) - - @JsonProperty("latest_rehire_date") - @ExcludeMissing - fun latestRehireDate(latestRehireDate: JsonField) = apply { - this.latestRehireDate = latestRehireDate - } - - /** `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 } - /** The detailed employment status of the individual. */ fun employmentStatus(employmentStatus: EmploymentStatus) = employmentStatus(JsonField.of(employmentStatus)) /** The detailed employment status of the individual. */ - @JsonProperty("employment_status") - @ExcludeMissing fun employmentStatus(employmentStatus: JsonField) = apply { this.employmentStatus = employmentStatus } - /** Worker's compensation classification code for this employee */ - fun classCode(classCode: String) = classCode(JsonField.of(classCode)) + fun endDate(endDate: String) = endDate(JsonField.of(endDate)) - /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") - @ExcludeMissing - fun classCode(classCode: JsonField) = apply { this.classCode = classCode } + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun location(location: Location) = location(JsonField.of(location)) + /** The legal first name of the individual. */ + fun firstName(firstName: String) = firstName(JsonField.of(firstName)) - @JsonProperty("location") - @ExcludeMissing - fun location(location: JsonField) = apply { this.location = location } + /** The legal first name of the individual. */ + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } /** * The employee's income as reported by the provider. This may not always be annualized @@ -377,100 +358,123 @@ private constructor( * 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)) + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - /** - * 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 + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + + /** The legal last name of the individual. */ + fun lastName(lastName: String) = lastName(JsonField.of(lastName)) + + /** The legal last name of the individual. */ + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + + fun latestRehireDate(latestRehireDate: String) = + latestRehireDate(JsonField.of(latestRehireDate)) + + fun latestRehireDate(latestRehireDate: JsonField) = apply { + this.latestRehireDate = latestRehireDate } + fun location(location: Location) = location(JsonField.of(location)) + + fun location(location: JsonField) = apply { this.location = location } + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager) = manager(JsonField.of(manager)) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: JsonField) = apply { this.manager = manager } + + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) + + /** The legal middle name of the individual. */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + /** The source system's unique employment identifier for this individual */ fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) /** The source system's unique employment identifier for this individual */ - @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)) + fun startDate(startDate: String) = startDate(JsonField.of(startDate)) - /** A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + + /** The current title of the individual. */ + fun title(title: String) = title(JsonField.of(title)) + + /** The current title of the individual. */ + fun title(title: JsonField) = apply { this.title = title } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmploymentUpdateResponse = EmploymentUpdateResponse( - firstName, - middleName, - lastName, - title, - manager, + id, + classCode, + customFields.map { it.toImmutable() }, department, employment, - startDate, - endDate, - latestRehireDate, - isActive, employmentStatus, - classCode, - location, + endDate, + firstName, income, incomeHistory.map { it.toImmutable() }, - customFields.map { it.toImmutable() }, + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, sourceId, - id, + startDate, + title, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = CustomField.Builder::class) @NoAutoDetect class CustomField + @JsonCreator private constructor( - private val name: JsonField, - private val value: JsonValue, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing private val value: JsonValue = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("name") @ExcludeMissing fun _name() = name @@ -481,6 +485,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): CustomField = apply { if (!validated) { name() @@ -503,35 +509,36 @@ private constructor( @JvmSynthetic internal fun from(customField: CustomField) = apply { - this.name = customField.name - this.value = customField.value - additionalProperties(customField.additionalProperties) + name = customField.name + value = customField.value + additionalProperties = customField.additionalProperties.toMutableMap() } 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CustomField = CustomField( name, @@ -559,16 +566,17 @@ private constructor( } /** The department object. */ - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The name of the department associated with the individual. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -579,6 +587,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -600,32 +610,35 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = department.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -648,20 +661,18 @@ private constructor( } /** The employment object. */ - @JsonDeserialize(builder = Employment.Builder::class) @NoAutoDetect class Employment + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** 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`. @@ -669,7 +680,7 @@ private constructor( fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) /** The main employment type of the individual. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, @@ -677,14 +688,19 @@ private constructor( */ @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + /** The main employment type of the individual. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Employment = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -698,25 +714,17 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = employment.subtype + type = employment.type + additionalProperties = employment.additionalProperties.toMutableMap() } - /** 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`. @@ -727,28 +735,37 @@ private constructor( * 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 } + /** The main employment type of the individual. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The main employment type of the individual. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Employment = Employment( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -896,17 +913,17 @@ private constructor( return true } - return /* spotless:off */ other is Employment && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Employment && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } class EmploymentStatus @@ -997,16 +1014,15 @@ private constructor( } /** The manager object representing the manager of the individual within the org. */ - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -1017,6 +1033,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -1038,32 +1056,35 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -1089,15 +1110,15 @@ private constructor( return true } - return /* spotless:off */ other is EmploymentUpdateResponse && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && title == other.title && manager == other.manager && department == other.department && employment == other.employment && startDate == other.startDate && endDate == other.endDate && latestRehireDate == other.latestRehireDate && isActive == other.isActive && employmentStatus == other.employmentStatus && classCode == other.classCode && location == other.location && income == other.income && incomeHistory == other.incomeHistory && customFields == other.customFields && sourceId == other.sourceId && id == other.id && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmploymentUpdateResponse && id == other.id && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstName, middleName, lastName, title, manager, department, employment, startDate, endDate, latestRehireDate, isActive, employmentStatus, classCode, location, income, incomeHistory, customFields, sourceId, id, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, sourceId, startDate, title, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmploymentUpdateResponse{firstName=$firstName, middleName=$middleName, lastName=$lastName, title=$title, manager=$manager, department=$department, employment=$employment, startDate=$startDate, endDate=$endDate, latestRehireDate=$latestRehireDate, isActive=$isActive, employmentStatus=$employmentStatus, classCode=$classCode, location=$location, income=$income, incomeHistory=$incomeHistory, customFields=$customFields, sourceId=$sourceId, id=$id, additionalProperties=$additionalProperties}" + "EmploymentUpdateResponse{id=$id, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt index 9b8a7819..03465d99 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt @@ -6,54 +6,56 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = EnrolledIndividual.Builder::class) @NoAutoDetect class EnrolledIndividual +@JsonCreator private constructor( - private val individualId: JsonField, - private val code: JsonField, - private val body: JsonField, - private val additionalProperties: Map, + @JsonProperty("body") @ExcludeMissing private val body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun body(): Optional = Optional.ofNullable(body.getNullable("body")) /** HTTP status code. Either 201 or 200 */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + @JsonProperty("body") @ExcludeMissing fun _body() = body /** HTTP status code. Either 201 or 200 */ @JsonProperty("code") @ExcludeMissing fun _code() = code - @JsonProperty("body") @ExcludeMissing fun _body() = body + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EnrolledIndividual = apply { if (!validated) { - individualId() - code() body().map { it.validate() } + code() + individualId() validated = true } } @@ -67,79 +69,80 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() private var body: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(enrolledIndividual: EnrolledIndividual) = apply { - this.individualId = enrolledIndividual.individualId - this.code = enrolledIndividual.code - this.body = enrolledIndividual.body - additionalProperties(enrolledIndividual.additionalProperties) + body = enrolledIndividual.body + code = enrolledIndividual.code + individualId = enrolledIndividual.individualId + additionalProperties = enrolledIndividual.additionalProperties.toMutableMap() } - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + fun body(body: Body) = body(JsonField.of(body)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId - } + fun body(body: JsonField) = apply { this.body = body } /** HTTP status code. Either 201 or 200 */ fun code(code: Code) = code(JsonField.of(code)) /** HTTP status code. Either 201 or 200 */ - @JsonProperty("code") - @ExcludeMissing fun code(code: JsonField) = apply { this.code = code } - fun body(body: Body) = body(JsonField.of(body)) + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField) = apply { this.body = body } + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EnrolledIndividual = EnrolledIndividual( - individualId, - code, body, + code, + individualId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Body.Builder::class) @NoAutoDetect class Body + @JsonCreator private constructor( - private val name: JsonField, - private val finchCode: JsonField, - private val message: JsonField, - private val additionalProperties: Map, + @JsonProperty("finch_code") + @ExcludeMissing + private val finchCode: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Identifier indicating whether the benefit was newly enrolled or updated. */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** A descriptive identifier for the response */ fun finchCode(): Optional = Optional.ofNullable(finchCode.getNullable("finch_code")) @@ -147,7 +150,7 @@ private constructor( fun message(): Optional = Optional.ofNullable(message.getNullable("message")) /** Identifier indicating whether the benefit was newly enrolled or updated. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** A descriptive identifier for the response */ @JsonProperty("finch_code") @ExcludeMissing fun _finchCode() = finchCode @@ -155,15 +158,20 @@ private constructor( /** Short description in English that provides more information about the response. */ @JsonProperty("message") @ExcludeMissing fun _message() = message + /** Identifier indicating whether the benefit was newly enrolled or updated. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Body = apply { if (!validated) { - name() finchCode() message() + name() validated = true } } @@ -177,62 +185,61 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var finchCode: JsonField = JsonMissing.of() private var message: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { - this.name = body.name - this.finchCode = body.finchCode - this.message = body.message - additionalProperties(body.additionalProperties) + finchCode = body.finchCode + message = body.message + name = body.name + additionalProperties = body.additionalProperties.toMutableMap() } - /** Identifier indicating whether the benefit was newly enrolled or updated. */ - fun name(name: String) = name(JsonField.of(name)) - - /** Identifier indicating whether the benefit was newly enrolled or updated. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** A descriptive identifier for the response */ fun finchCode(finchCode: String) = finchCode(JsonField.of(finchCode)) /** A descriptive identifier for the response */ - @JsonProperty("finch_code") - @ExcludeMissing fun finchCode(finchCode: JsonField) = apply { this.finchCode = finchCode } /** Short description in English that provides more information about the response. */ fun message(message: String) = message(JsonField.of(message)) /** Short description in English that provides more information about the response. */ - @JsonProperty("message") - @ExcludeMissing fun message(message: JsonField) = apply { this.message = message } + /** Identifier indicating whether the benefit was newly enrolled or updated. */ + fun name(name: String) = name(JsonField.of(name)) + + /** Identifier indicating whether the benefit was newly enrolled or updated. */ + fun name(name: JsonField) = apply { this.name = name } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Body = Body( - name, finchCode, message, + name, additionalProperties.toImmutable(), ) } @@ -242,17 +249,17 @@ private constructor( return true } - return /* spotless:off */ other is Body && name == other.name && finchCode == other.finchCode && message == other.message && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && finchCode == other.finchCode && message == other.message && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, finchCode, message, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(finchCode, message, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{name=$name, finchCode=$finchCode, message=$message, additionalProperties=$additionalProperties}" + "Body{finchCode=$finchCode, message=$message, name=$name, additionalProperties=$additionalProperties}" } class Code @@ -329,15 +336,15 @@ private constructor( return true } - return /* spotless:off */ other is EnrolledIndividual && individualId == other.individualId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EnrolledIndividual && body == other.body && code == other.code && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, code, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, code, individualId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EnrolledIndividual{individualId=$individualId, code=$code, body=$body, additionalProperties=$additionalProperties}" + "EnrolledIndividual{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt index d8c1576e..1ddf9377 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt @@ -4,73 +4,71 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional class HrisBenefitCreateParams constructor( - private val description: String?, - private val frequency: BenefitFrequency?, - private val type: BenefitType?, + private val body: HrisBenefitCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun description(): Optional = Optional.ofNullable(description) + /** + * Name of the benefit as it appears in the provider and pay statements. Recommend limiting this + * to <30 characters due to limitations in specific providers (e.g. Justworks). + */ + fun description(): Optional = body.description() - fun frequency(): Optional = Optional.ofNullable(frequency) + fun frequency(): Optional = body.frequency() - fun type(): Optional = Optional.ofNullable(type) + /** Type of benefit. */ + fun type(): Optional = body.type() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): HrisBenefitCreateBody { - return HrisBenefitCreateBody( - description, - frequency, - type, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): HrisBenefitCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = HrisBenefitCreateBody.Builder::class) @NoAutoDetect class HrisBenefitCreateBody + @JsonCreator internal constructor( - private val description: String?, - private val frequency: BenefitFrequency?, - private val type: BenefitType?, - private val additionalProperties: Map, + @JsonProperty("description") private val description: String?, + @JsonProperty("frequency") private val frequency: BenefitFrequency?, + @JsonProperty("type") private val type: BenefitType?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** * Name of the benefit as it appears in the provider and pay statements. Recommend limiting * this to <30 characters due to limitations in specific providers (e.g. Justworks). */ - @JsonProperty("description") fun description(): String? = description + @JsonProperty("description") + fun description(): Optional = Optional.ofNullable(description) - @JsonProperty("frequency") fun frequency(): BenefitFrequency? = frequency + @JsonProperty("frequency") + fun frequency(): Optional = Optional.ofNullable(frequency) /** Type of benefit. */ - @JsonProperty("type") fun type(): BenefitType? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -92,10 +90,10 @@ constructor( @JvmSynthetic internal fun from(hrisBenefitCreateBody: HrisBenefitCreateBody) = apply { - this.description = hrisBenefitCreateBody.description - this.frequency = hrisBenefitCreateBody.frequency - this.type = hrisBenefitCreateBody.type - additionalProperties(hrisBenefitCreateBody.additionalProperties) + description = hrisBenefitCreateBody.description + frequency = hrisBenefitCreateBody.frequency + type = hrisBenefitCreateBody.type + additionalProperties = hrisBenefitCreateBody.additionalProperties.toMutableMap() } /** @@ -103,29 +101,44 @@ constructor( * limiting this to <30 characters due to limitations in specific providers (e.g. * Justworks). */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } + + /** + * Name of the benefit as it appears in the provider and pay statements. Recommend + * limiting this to <30 characters due to limitations in specific providers (e.g. + * Justworks). + */ + fun description(description: Optional) = description(description.orElse(null)) + + fun frequency(frequency: BenefitFrequency?) = apply { this.frequency = frequency } + + fun frequency(frequency: Optional) = frequency(frequency.orElse(null)) - @JsonProperty("frequency") - fun frequency(frequency: BenefitFrequency) = apply { this.frequency = frequency } + /** Type of benefit. */ + fun type(type: BenefitType?) = apply { this.type = type } /** Type of benefit. */ - @JsonProperty("type") fun type(type: BenefitType) = apply { this.type = type } + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): HrisBenefitCreateBody = HrisBenefitCreateBody( description, @@ -163,34 +176,38 @@ constructor( @NoAutoDetect class Builder { - private var description: String? = null - private var frequency: BenefitFrequency? = null - private var type: BenefitType? = null + private var body: HrisBenefitCreateBody.Builder = HrisBenefitCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisBenefitCreateParams: HrisBenefitCreateParams) = apply { - description = hrisBenefitCreateParams.description - frequency = hrisBenefitCreateParams.frequency - type = hrisBenefitCreateParams.type + body = hrisBenefitCreateParams.body.toBuilder() additionalHeaders = hrisBenefitCreateParams.additionalHeaders.toBuilder() additionalQueryParams = hrisBenefitCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - hrisBenefitCreateParams.additionalBodyProperties.toMutableMap() } /** * Name of the benefit as it appears in the provider and pay statements. Recommend limiting * this to <30 characters due to limitations in specific providers (e.g. Justworks). */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { body.description(description) } - fun frequency(frequency: BenefitFrequency) = apply { this.frequency = frequency } + /** + * Name of the benefit as it appears in the provider and pay statements. Recommend limiting + * this to <30 characters due to limitations in specific providers (e.g. Justworks). + */ + fun description(description: Optional) = description(description.orElse(null)) + + fun frequency(frequency: BenefitFrequency?) = apply { body.frequency(frequency) } + + fun frequency(frequency: Optional) = frequency(frequency.orElse(null)) /** Type of benefit. */ - fun type(type: BenefitType) = apply { this.type = type } + fun type(type: BenefitType?) = apply { body.type(type) } + + /** Type of benefit. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -291,35 +308,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): HrisBenefitCreateParams = HrisBenefitCreateParams( - description, - frequency, - type, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -328,11 +339,11 @@ constructor( return true } - return /* spotless:off */ other is HrisBenefitCreateParams && description == other.description && frequency == other.frequency && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is HrisBenefitCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(description, frequency, type, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "HrisBenefitCreateParams{description=$description, frequency=$frequency, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "HrisBenefitCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt index 9cfaf1e0..f5f1d11d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.benefits.IndividualService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -130,10 +133,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt index 17c53431..b9f4793c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsync import java.util.Objects @@ -75,12 +76,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -134,10 +137,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt index b9d639fb..0b271e6c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt @@ -18,6 +18,10 @@ constructor( fun benefitId(): String = benefitId + /** + * comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all + * individuals + */ fun individualIds(): Optional = Optional.ofNullable(individualIds) fun _additionalHeaders(): Headers = additionalHeaders @@ -75,7 +79,14 @@ constructor( * comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all * individuals */ - fun individualIds(individualIds: String) = apply { this.individualIds = individualIds } + fun individualIds(individualIds: String?) = apply { this.individualIds = individualIds } + + /** + * comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all + * individuals + */ + fun individualIds(individualIds: Optional) = + individualIds(individualIds.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt index 0fa3731d..6fe68d85 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.benefits.IndividualService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -130,10 +133,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt index 922e047c..b4fdd6c4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,10 +136,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt index b88ad19a..5952a750 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt @@ -4,13 +4,14 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional @@ -18,26 +19,23 @@ import java.util.Optional class HrisBenefitIndividualUnenrollManyParams constructor( private val benefitId: String, - private val individualIds: List?, + private val body: HrisBenefitIndividualUnenrollManyBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun benefitId(): String = benefitId - fun individualIds(): Optional> = Optional.ofNullable(individualIds) + /** Array of individual_ids to unenroll. */ + fun individualIds(): Optional> = body.individualIds() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): HrisBenefitIndividualUnenrollManyBody { - return HrisBenefitIndividualUnenrollManyBody(individualIds, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): HrisBenefitIndividualUnenrollManyBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -50,16 +48,18 @@ constructor( } } - @JsonDeserialize(builder = HrisBenefitIndividualUnenrollManyBody.Builder::class) @NoAutoDetect class HrisBenefitIndividualUnenrollManyBody + @JsonCreator internal constructor( - private val individualIds: List?, - private val additionalProperties: Map, + @JsonProperty("individual_ids") private val individualIds: List?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** Array of individual_ids to unenroll. */ - @JsonProperty("individual_ids") fun individualIds(): List? = individualIds + @JsonProperty("individual_ids") + fun individualIds(): Optional> = Optional.ofNullable(individualIds) @JsonAnyGetter @ExcludeMissing @@ -74,37 +74,51 @@ constructor( class Builder { - private var individualIds: List? = null + private var individualIds: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( hrisBenefitIndividualUnenrollManyBody: HrisBenefitIndividualUnenrollManyBody ) = apply { - this.individualIds = hrisBenefitIndividualUnenrollManyBody.individualIds - additionalProperties(hrisBenefitIndividualUnenrollManyBody.additionalProperties) + individualIds = hrisBenefitIndividualUnenrollManyBody.individualIds?.toMutableList() + additionalProperties = + hrisBenefitIndividualUnenrollManyBody.additionalProperties.toMutableMap() } /** Array of individual_ids to unenroll. */ - @JsonProperty("individual_ids") - fun individualIds(individualIds: List) = apply { - this.individualIds = individualIds + fun individualIds(individualIds: List?) = apply { + this.individualIds = individualIds?.toMutableList() + } + + /** Array of individual_ids to unenroll. */ + fun individualIds(individualIds: Optional>) = + individualIds(individualIds.orElse(null)) + + /** Array of individual_ids to unenroll. */ + fun addIndividualId(individualId: String) = apply { + individualIds = (individualIds ?: mutableListOf()).apply { add(individualId) } } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): HrisBenefitIndividualUnenrollManyBody = HrisBenefitIndividualUnenrollManyBody( individualIds?.toImmutable(), @@ -141,37 +155,36 @@ constructor( class Builder { private var benefitId: String? = null - private var individualIds: MutableList = mutableListOf() + private var body: HrisBenefitIndividualUnenrollManyBody.Builder = + HrisBenefitIndividualUnenrollManyBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( hrisBenefitIndividualUnenrollManyParams: HrisBenefitIndividualUnenrollManyParams ) = apply { benefitId = hrisBenefitIndividualUnenrollManyParams.benefitId - individualIds = - hrisBenefitIndividualUnenrollManyParams.individualIds?.toMutableList() - ?: mutableListOf() + body = hrisBenefitIndividualUnenrollManyParams.body.toBuilder() additionalHeaders = hrisBenefitIndividualUnenrollManyParams.additionalHeaders.toBuilder() additionalQueryParams = hrisBenefitIndividualUnenrollManyParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - hrisBenefitIndividualUnenrollManyParams.additionalBodyProperties.toMutableMap() } fun benefitId(benefitId: String) = apply { this.benefitId = benefitId } /** Array of individual_ids to unenroll. */ - fun individualIds(individualIds: List) = apply { - this.individualIds.clear() - this.individualIds.addAll(individualIds) + fun individualIds(individualIds: List?) = apply { + body.individualIds(individualIds) } /** Array of individual_ids to unenroll. */ - fun addIndividualId(individualId: String) = apply { this.individualIds.add(individualId) } + fun individualIds(individualIds: Optional>) = + individualIds(individualIds.orElse(null)) + + /** Array of individual_ids to unenroll. */ + fun addIndividualId(individualId: String) = apply { body.addIndividualId(individualId) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -272,34 +285,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): HrisBenefitIndividualUnenrollManyParams = HrisBenefitIndividualUnenrollManyParams( checkNotNull(benefitId) { "`benefitId` is required but was not set" }, - individualIds.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -308,11 +317,11 @@ constructor( return true } - return /* spotless:off */ other is HrisBenefitIndividualUnenrollManyParams && benefitId == other.benefitId && individualIds == other.individualIds && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is HrisBenefitIndividualUnenrollManyParams && benefitId == other.benefitId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitId, individualIds, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "HrisBenefitIndividualUnenrollManyParams{benefitId=$benefitId, individualIds=$individualIds, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "HrisBenefitIndividualUnenrollManyParams{benefitId=$benefitId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt index 56ba5279..5c9d3159 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.BenefitService import java.util.Objects @@ -67,12 +68,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -126,10 +129,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt index 2e7db706..ad78a2d4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.BenefitServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,10 +136,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index 07a10a48..95cd2dbe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.BenefitService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -130,10 +133,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index 6871d84a..e00f8e52 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.BenefitServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,10 +136,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt index 34ef135d..5c741e26 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt @@ -4,13 +4,14 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional @@ -18,26 +19,23 @@ import java.util.Optional class HrisBenefitUpdateParams constructor( private val benefitId: String, - private val description: String?, + private val body: HrisBenefitUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun benefitId(): String = benefitId - fun description(): Optional = Optional.ofNullable(description) + /** Updated name or description. */ + fun description(): Optional = body.description() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): HrisBenefitUpdateBody { - return HrisBenefitUpdateBody(description, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): HrisBenefitUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -50,16 +48,18 @@ constructor( } } - @JsonDeserialize(builder = HrisBenefitUpdateBody.Builder::class) @NoAutoDetect class HrisBenefitUpdateBody + @JsonCreator internal constructor( - private val description: String?, - private val additionalProperties: Map, + @JsonProperty("description") private val description: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** Updated name or description. */ - @JsonProperty("description") fun description(): String? = description + @JsonProperty("description") + fun description(): Optional = Optional.ofNullable(description) @JsonAnyGetter @ExcludeMissing @@ -79,28 +79,35 @@ constructor( @JvmSynthetic internal fun from(hrisBenefitUpdateBody: HrisBenefitUpdateBody) = apply { - this.description = hrisBenefitUpdateBody.description - additionalProperties(hrisBenefitUpdateBody.additionalProperties) + description = hrisBenefitUpdateBody.description + additionalProperties = hrisBenefitUpdateBody.additionalProperties.toMutableMap() } /** Updated name or description. */ - @JsonProperty("description") - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { this.description = description } + + /** Updated name or description. */ + fun description(description: Optional) = description(description.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): HrisBenefitUpdateBody = HrisBenefitUpdateBody(description, additionalProperties.toImmutable()) } @@ -134,25 +141,25 @@ constructor( class Builder { private var benefitId: String? = null - private var description: String? = null + private var body: HrisBenefitUpdateBody.Builder = HrisBenefitUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisBenefitUpdateParams: HrisBenefitUpdateParams) = apply { benefitId = hrisBenefitUpdateParams.benefitId - description = hrisBenefitUpdateParams.description + body = hrisBenefitUpdateParams.body.toBuilder() additionalHeaders = hrisBenefitUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = hrisBenefitUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - hrisBenefitUpdateParams.additionalBodyProperties.toMutableMap() } fun benefitId(benefitId: String) = apply { this.benefitId = benefitId } /** Updated name or description. */ - fun description(description: String) = apply { this.description = description } + fun description(description: String?) = apply { body.description(description) } + + /** Updated name or description. */ + fun description(description: Optional) = description(description.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -253,34 +260,30 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): HrisBenefitUpdateParams = HrisBenefitUpdateParams( checkNotNull(benefitId) { "`benefitId` is required but was not set" }, - description, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -289,11 +292,11 @@ constructor( return true } - return /* spotless:off */ other is HrisBenefitUpdateParams && benefitId == other.benefitId && description == other.description && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is HrisBenefitUpdateParams && benefitId == other.benefitId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitId, description, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "HrisBenefitUpdateParams{benefitId=$benefitId, description=$description, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "HrisBenefitUpdateParams{benefitId=$benefitId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 9ab6f318..b24aa8e9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.DirectoryService import java.util.Objects @@ -83,13 +84,15 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val individuals: JsonField>, - private val paging: JsonField, - private val additionalProperties: Map, + @JsonProperty("individuals") + private val individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -154,17 +157,14 @@ private constructor( fun individuals(individuals: List) = individuals(JsonField.of(individuals)) - @JsonProperty("individuals") fun individuals(individuals: JsonField>) = apply { this.individuals = individuals } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") fun paging(paging: JsonField) = apply { this.paging = paging } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index 347dc98e..b0d74067 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.DirectoryServiceAsync import java.util.Objects @@ -86,13 +87,15 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val individuals: JsonField>, - private val paging: JsonField, - private val additionalProperties: Map, + @JsonProperty("individuals") + private val individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -157,17 +160,14 @@ private constructor( fun individuals(individuals: List) = individuals(JsonField.of(individuals)) - @JsonProperty("individuals") fun individuals(individuals: JsonField>) = apply { this.individuals = individuals } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") fun paging(paging: JsonField) = apply { this.paging = paging } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index 2c09b00e..205c4872 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -16,8 +16,10 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** Number of employees to return (defaults to all) */ fun limit(): Optional = Optional.ofNullable(limit) + /** Index to start from (defaults to 0) */ fun offset(): Optional = Optional.ofNullable(offset) fun _additionalHeaders(): Headers = additionalHeaders @@ -61,10 +63,24 @@ constructor( } /** Number of employees to return (defaults to all) */ - fun limit(limit: Long) = apply { this.limit = limit } + fun limit(limit: Long?) = apply { this.limit = limit } + + /** Number of employees to return (defaults to all) */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Number of employees to return (defaults to all) */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long?) = apply { this.offset = offset } + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - fun offset(offset: Long) = apply { this.offset = offset } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index a72ee4ff..fc5cb237 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.DirectoryService import java.util.Objects @@ -82,13 +83,15 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val individuals: JsonField>, - private val paging: JsonField, - private val additionalProperties: Map, + @JsonProperty("individuals") + private val individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -153,17 +156,14 @@ private constructor( fun individuals(individuals: List) = individuals(JsonField.of(individuals)) - @JsonProperty("individuals") fun individuals(individuals: JsonField>) = apply { this.individuals = individuals } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") fun paging(paging: JsonField) = apply { this.paging = paging } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index 3ab7e847..75f3a775 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.DirectoryServiceAsync import java.util.Objects @@ -85,13 +86,15 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val individuals: JsonField>, - private val paging: JsonField, - private val additionalProperties: Map, + @JsonProperty("individuals") + private val individuals: JsonField> = JsonMissing.of(), + @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -156,17 +159,14 @@ private constructor( fun individuals(individuals: List) = individuals(JsonField.of(individuals)) - @JsonProperty("individuals") fun individuals(individuals: JsonField>) = apply { this.individuals = individuals } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") fun paging(paging: JsonField) = apply { this.paging = paging } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index ffc4b4bd..f54344d2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -16,8 +16,10 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** Number of employees to return (defaults to all) */ fun limit(): Optional = Optional.ofNullable(limit) + /** Index to start from (defaults to 0) */ fun offset(): Optional = Optional.ofNullable(offset) fun _additionalHeaders(): Headers = additionalHeaders @@ -59,10 +61,24 @@ constructor( } /** Number of employees to return (defaults to all) */ - fun limit(limit: Long) = apply { this.limit = limit } + fun limit(limit: Long?) = apply { this.limit = limit } + + /** Number of employees to return (defaults to all) */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Number of employees to return (defaults to all) */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long?) = apply { this.offset = offset } + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - fun offset(offset: Long) = apply { this.offset = offset } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index bf9ca300..71ea48eb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.EmploymentService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val responses: JsonField>, - private val additionalProperties: Map, + @JsonProperty("responses") + private val responses: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,12 +136,10 @@ private constructor( fun responses(responses: List) = responses(JsonField.of(responses)) - @JsonProperty("responses") fun responses(responses: JsonField>) = apply { this.responses = responses } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index a6e2e991..9c7d988d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.EmploymentServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val responses: JsonField>, - private val additionalProperties: Map, + @JsonProperty("responses") + private val responses: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -136,12 +139,10 @@ private constructor( fun responses(responses: List) = responses(JsonField.of(responses)) - @JsonProperty("responses") fun responses(responses: JsonField>) = apply { this.responses = responses } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index 191b1fd6..16e6ac00 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -4,52 +4,51 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects class HrisEmploymentRetrieveManyParams constructor( - private val requests: List, + private val body: HrisEmploymentRetrieveManyBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun requests(): List = requests + /** The array of batch requests. */ + fun requests(): List = body.requests() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): HrisEmploymentRetrieveManyBody { - return HrisEmploymentRetrieveManyBody(requests, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): HrisEmploymentRetrieveManyBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams /** Individual Ids Request Body */ - @JsonDeserialize(builder = HrisEmploymentRetrieveManyBody.Builder::class) @NoAutoDetect class HrisEmploymentRetrieveManyBody + @JsonCreator internal constructor( - private val requests: List?, - private val additionalProperties: Map, + @JsonProperty("requests") private val requests: List, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The array of batch requests. */ - @JsonProperty("requests") fun requests(): List? = requests + @JsonProperty("requests") fun requests(): List = requests @JsonAnyGetter @ExcludeMissing @@ -64,34 +63,46 @@ constructor( class Builder { - private var requests: List? = null + private var requests: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisEmploymentRetrieveManyBody: HrisEmploymentRetrieveManyBody) = apply { - this.requests = hrisEmploymentRetrieveManyBody.requests - additionalProperties(hrisEmploymentRetrieveManyBody.additionalProperties) + requests = hrisEmploymentRetrieveManyBody.requests.toMutableList() + additionalProperties = + hrisEmploymentRetrieveManyBody.additionalProperties.toMutableMap() } /** The array of batch requests. */ - @JsonProperty("requests") - fun requests(requests: List) = apply { this.requests = requests } + fun requests(requests: List) = apply { + this.requests = requests.toMutableList() + } + + /** The array of batch requests. */ + fun addRequest(request: Request) = apply { + requests = (requests ?: mutableListOf()).apply { add(request) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): HrisEmploymentRetrieveManyBody = HrisEmploymentRetrieveManyBody( checkNotNull(requests) { "`requests` is required but was not set" } @@ -128,30 +139,25 @@ constructor( @NoAutoDetect class Builder { - private var requests: MutableList = mutableListOf() + private var body: HrisEmploymentRetrieveManyBody.Builder = + HrisEmploymentRetrieveManyBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisEmploymentRetrieveManyParams: HrisEmploymentRetrieveManyParams) = apply { - requests = hrisEmploymentRetrieveManyParams.requests.toMutableList() + body = hrisEmploymentRetrieveManyParams.body.toBuilder() additionalHeaders = hrisEmploymentRetrieveManyParams.additionalHeaders.toBuilder() additionalQueryParams = hrisEmploymentRetrieveManyParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - hrisEmploymentRetrieveManyParams.additionalBodyProperties.toMutableMap() } /** The array of batch requests. */ - fun requests(requests: List) = apply { - this.requests.clear() - this.requests.addAll(requests) - } + fun requests(requests: List) = apply { body.requests(requests) } /** The array of batch requests. */ - fun addRequest(request: Request) = apply { this.requests.add(request) } + fun addRequest(request: Request) = apply { body.addRequest(request) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -252,42 +258,39 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): HrisEmploymentRetrieveManyParams = HrisEmploymentRetrieveManyParams( - requests.toImmutable(), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Request.Builder::class) @NoAutoDetect class Request + @JsonCreator private constructor( - private val individualId: String?, - private val additionalProperties: Map, + @JsonProperty("individual_id") private val individualId: String, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** @@ -295,7 +298,7 @@ constructor( * number of `individual_id` to send per request. It is preferantial to send all ids in a * single request for Finch to optimize provider rate-limits. */ - @JsonProperty("individual_id") fun individualId(): String? = individualId + @JsonProperty("individual_id") fun individualId(): String = individualId @JsonAnyGetter @ExcludeMissing @@ -315,8 +318,8 @@ constructor( @JvmSynthetic internal fun from(request: Request) = apply { - this.individualId = request.individualId - additionalProperties(request.additionalProperties) + individualId = request.individualId + additionalProperties = request.additionalProperties.toMutableMap() } /** @@ -324,23 +327,27 @@ constructor( * the number of `individual_id` to send per request. It is preferantial to send all ids * in a single request for Finch to optimize provider rate-limits. */ - @JsonProperty("individual_id") fun individualId(individualId: String) = apply { this.individualId = individualId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Request = Request( checkNotNull(individualId) { "`individualId` is required but was not set" }, @@ -371,11 +378,11 @@ constructor( return true } - return /* spotless:off */ other is HrisEmploymentRetrieveManyParams && requests == other.requests && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is HrisEmploymentRetrieveManyParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(requests, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "HrisEmploymentRetrieveManyParams{requests=$requests, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "HrisEmploymentRetrieveManyParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index 4207b791..72a1d20e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.IndividualService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val responses: JsonField>, - private val additionalProperties: Map, + @JsonProperty("responses") + private val responses: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -131,12 +134,10 @@ private constructor( fun responses(responses: List) = responses(JsonField.of(responses)) - @JsonProperty("responses") fun responses(responses: JsonField>) = apply { this.responses = responses } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index b78233a3..efdfe58a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.IndividualServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val responses: JsonField>, - private val additionalProperties: Map, + @JsonProperty("responses") + private val responses: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -134,12 +137,10 @@ private constructor( fun responses(responses: List) = responses(JsonField.of(responses)) - @JsonProperty("responses") fun responses(responses: JsonField>) = apply { this.responses = responses } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index 1d9659f6..79acf859 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -4,61 +4,55 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional class HrisIndividualRetrieveManyParams constructor( - private val options: Options?, - private val requests: List?, + private val body: HrisIndividualRetrieveManyBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun options(): Optional = Optional.ofNullable(options) + fun options(): Optional = body.options() - fun requests(): Optional> = Optional.ofNullable(requests) + fun requests(): Optional> = body.requests() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): HrisIndividualRetrieveManyBody { - return HrisIndividualRetrieveManyBody( - options, - requests, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): HrisIndividualRetrieveManyBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = HrisIndividualRetrieveManyBody.Builder::class) @NoAutoDetect class HrisIndividualRetrieveManyBody + @JsonCreator internal constructor( - private val options: Options?, - private val requests: List?, - private val additionalProperties: Map, + @JsonProperty("options") private val options: Options?, + @JsonProperty("requests") private val requests: List?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("options") fun options(): Options? = options + @JsonProperty("options") fun options(): Optional = Optional.ofNullable(options) - @JsonProperty("requests") fun requests(): List? = requests + @JsonProperty("requests") + fun requests(): Optional> = Optional.ofNullable(requests) @JsonAnyGetter @ExcludeMissing @@ -74,37 +68,51 @@ constructor( class Builder { private var options: Options? = null - private var requests: List? = null + private var requests: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisIndividualRetrieveManyBody: HrisIndividualRetrieveManyBody) = apply { - this.options = hrisIndividualRetrieveManyBody.options - this.requests = hrisIndividualRetrieveManyBody.requests - additionalProperties(hrisIndividualRetrieveManyBody.additionalProperties) + options = hrisIndividualRetrieveManyBody.options + requests = hrisIndividualRetrieveManyBody.requests?.toMutableList() + additionalProperties = + hrisIndividualRetrieveManyBody.additionalProperties.toMutableMap() } - @JsonProperty("options") - fun options(options: Options) = apply { this.options = options } + fun options(options: Options?) = apply { this.options = options } + + fun options(options: Optional) = options(options.orElse(null)) + + fun requests(requests: List?) = apply { + this.requests = requests?.toMutableList() + } - @JsonProperty("requests") - fun requests(requests: List) = apply { this.requests = requests } + fun requests(requests: Optional>) = requests(requests.orElse(null)) + + fun addRequest(request: Request) = apply { + requests = (requests ?: mutableListOf()).apply { add(request) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): HrisIndividualRetrieveManyBody = HrisIndividualRetrieveManyBody( options, @@ -141,33 +149,29 @@ constructor( @NoAutoDetect class Builder { - private var options: Options? = null - private var requests: MutableList = mutableListOf() + private var body: HrisIndividualRetrieveManyBody.Builder = + HrisIndividualRetrieveManyBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisIndividualRetrieveManyParams: HrisIndividualRetrieveManyParams) = apply { - options = hrisIndividualRetrieveManyParams.options - requests = - hrisIndividualRetrieveManyParams.requests?.toMutableList() ?: mutableListOf() + body = hrisIndividualRetrieveManyParams.body.toBuilder() additionalHeaders = hrisIndividualRetrieveManyParams.additionalHeaders.toBuilder() additionalQueryParams = hrisIndividualRetrieveManyParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - hrisIndividualRetrieveManyParams.additionalBodyProperties.toMutableMap() } - fun options(options: Options) = apply { this.options = options } + fun options(options: Options?) = apply { body.options(options) } - fun requests(requests: List) = apply { - this.requests.clear() - this.requests.addAll(requests) - } + fun options(options: Optional) = options(options.orElse(null)) + + fun requests(requests: List?) = apply { body.requests(requests) } + + fun requests(requests: Optional>) = requests(requests.orElse(null)) - fun addRequest(request: Request) = apply { this.requests.add(request) } + fun addRequest(request: Request) = apply { body.addRequest(request) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -268,46 +272,43 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams( - options, - requests.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Options.Builder::class) @NoAutoDetect class Options + @JsonCreator private constructor( - private val include: List?, - private val additionalProperties: Map, + @JsonProperty("include") private val include: List?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("include") fun include(): List? = include + @JsonProperty("include") + fun include(): Optional> = Optional.ofNullable(include) @JsonAnyGetter @ExcludeMissing @@ -322,32 +323,42 @@ constructor( class Builder { - private var include: List? = null + private var include: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(options: Options) = apply { - this.include = options.include - additionalProperties(options.additionalProperties) + include = options.include?.toMutableList() + additionalProperties = options.additionalProperties.toMutableMap() } - @JsonProperty("include") - fun include(include: List) = apply { this.include = include } + fun include(include: List?) = apply { this.include = include?.toMutableList() } + + fun include(include: Optional>) = include(include.orElse(null)) + + fun addInclude(include: String) = apply { + this.include = (this.include ?: mutableListOf()).apply { add(include) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Options = Options(include?.toImmutable(), additionalProperties.toImmutable()) } @@ -370,15 +381,17 @@ constructor( "Options{include=$include, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Request.Builder::class) @NoAutoDetect class Request + @JsonCreator private constructor( - private val individualId: String?, - private val additionalProperties: Map, + @JsonProperty("individual_id") private val individualId: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("individual_id") fun individualId(): String? = individualId + @JsonProperty("individual_id") + fun individualId(): Optional = Optional.ofNullable(individualId) @JsonAnyGetter @ExcludeMissing @@ -398,27 +411,34 @@ constructor( @JvmSynthetic internal fun from(request: Request) = apply { - this.individualId = request.individualId - additionalProperties(request.additionalProperties) + individualId = request.individualId + additionalProperties = request.additionalProperties.toMutableMap() } - @JsonProperty("individual_id") - fun individualId(individualId: String) = apply { this.individualId = individualId } + fun individualId(individualId: String?) = apply { this.individualId = individualId } + + fun individualId(individualId: Optional) = + individualId(individualId.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Request = Request(individualId, additionalProperties.toImmutable()) } @@ -445,11 +465,11 @@ constructor( return true } - return /* spotless:off */ other is HrisIndividualRetrieveManyParams && options == other.options && requests == other.requests && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is HrisIndividualRetrieveManyParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(options, requests, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "HrisIndividualRetrieveManyParams{options=$options, requests=$requests, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "HrisIndividualRetrieveManyParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index 55ce79fd..0c3034b0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.PayStatementService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val responses: JsonField>, - private val additionalProperties: Map, + @JsonProperty("responses") + private val responses: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -132,12 +135,10 @@ private constructor( fun responses(responses: List) = responses(JsonField.of(responses)) - @JsonProperty("responses") fun responses(responses: JsonField>) = apply { this.responses = responses } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index 720003e1..84291ccb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.PayStatementServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val responses: JsonField>, - private val additionalProperties: Map, + @JsonProperty("responses") + private val responses: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -135,12 +138,10 @@ private constructor( fun responses(responses: List) = responses(JsonField.of(responses)) - @JsonProperty("responses") fun responses(responses: JsonField>) = apply { this.responses = responses } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index bb509264..a1446c29 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -4,51 +4,51 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects +import java.util.Optional class HrisPayStatementRetrieveManyParams constructor( - private val requests: List, + private val body: HrisPayStatementRetrieveManyBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun requests(): List = requests + /** The array of batch requests. */ + fun requests(): List = body.requests() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): HrisPayStatementRetrieveManyBody { - return HrisPayStatementRetrieveManyBody(requests, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): HrisPayStatementRetrieveManyBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = HrisPayStatementRetrieveManyBody.Builder::class) @NoAutoDetect class HrisPayStatementRetrieveManyBody + @JsonCreator internal constructor( - private val requests: List?, - private val additionalProperties: Map, + @JsonProperty("requests") private val requests: List, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The array of batch requests. */ - @JsonProperty("requests") fun requests(): List? = requests + @JsonProperty("requests") fun requests(): List = requests @JsonAnyGetter @ExcludeMissing @@ -63,34 +63,46 @@ constructor( class Builder { - private var requests: List? = null + private var requests: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisPayStatementRetrieveManyBody: HrisPayStatementRetrieveManyBody) = apply { - this.requests = hrisPayStatementRetrieveManyBody.requests - additionalProperties(hrisPayStatementRetrieveManyBody.additionalProperties) + requests = hrisPayStatementRetrieveManyBody.requests.toMutableList() + additionalProperties = + hrisPayStatementRetrieveManyBody.additionalProperties.toMutableMap() } /** The array of batch requests. */ - @JsonProperty("requests") - fun requests(requests: List) = apply { this.requests = requests } + fun requests(requests: List) = apply { + this.requests = requests.toMutableList() + } + + /** The array of batch requests. */ + fun addRequest(request: Request) = apply { + requests = (requests ?: mutableListOf()).apply { add(request) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): HrisPayStatementRetrieveManyBody = HrisPayStatementRetrieveManyBody( checkNotNull(requests) { "`requests` is required but was not set" } @@ -127,30 +139,25 @@ constructor( @NoAutoDetect class Builder { - private var requests: MutableList = mutableListOf() + private var body: HrisPayStatementRetrieveManyBody.Builder = + HrisPayStatementRetrieveManyBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(hrisPayStatementRetrieveManyParams: HrisPayStatementRetrieveManyParams) = apply { - requests = hrisPayStatementRetrieveManyParams.requests.toMutableList() + body = hrisPayStatementRetrieveManyParams.body.toBuilder() additionalHeaders = hrisPayStatementRetrieveManyParams.additionalHeaders.toBuilder() additionalQueryParams = hrisPayStatementRetrieveManyParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - hrisPayStatementRetrieveManyParams.additionalBodyProperties.toMutableMap() } /** The array of batch requests. */ - fun requests(requests: List) = apply { - this.requests.clear() - this.requests.addAll(requests) - } + fun requests(requests: List) = apply { body.requests(requests) } /** The array of batch requests. */ - fun addRequest(request: Request) = apply { this.requests.add(request) } + fun addRequest(request: Request) = apply { body.addRequest(request) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -251,54 +258,51 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): HrisPayStatementRetrieveManyParams = HrisPayStatementRetrieveManyParams( - requests.toImmutable(), + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Request.Builder::class) @NoAutoDetect class Request + @JsonCreator private constructor( - private val paymentId: String?, - private val limit: Long?, - private val offset: Long?, - private val additionalProperties: Map, + @JsonProperty("payment_id") private val paymentId: String, + @JsonProperty("limit") private val limit: Long?, + @JsonProperty("offset") private val offset: Long?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** A stable Finch `id` (UUID v4) for a payment. */ - @JsonProperty("payment_id") fun paymentId(): String? = paymentId + @JsonProperty("payment_id") fun paymentId(): String = paymentId /** Number of pay statements to return (defaults to all). */ - @JsonProperty("limit") fun limit(): Long? = limit + @JsonProperty("limit") fun limit(): Optional = Optional.ofNullable(limit) /** Index to start from. */ - @JsonProperty("offset") fun offset(): Long? = offset + @JsonProperty("offset") fun offset(): Optional = Optional.ofNullable(offset) @JsonAnyGetter @ExcludeMissing @@ -320,36 +324,54 @@ constructor( @JvmSynthetic internal fun from(request: Request) = apply { - this.paymentId = request.paymentId - this.limit = request.limit - this.offset = request.offset - additionalProperties(request.additionalProperties) + paymentId = request.paymentId + limit = request.limit + offset = request.offset + additionalProperties = request.additionalProperties.toMutableMap() } /** A stable Finch `id` (UUID v4) for a payment. */ - @JsonProperty("payment_id") fun paymentId(paymentId: String) = apply { this.paymentId = paymentId } /** Number of pay statements to return (defaults to all). */ - @JsonProperty("limit") fun limit(limit: Long) = apply { this.limit = limit } + fun limit(limit: Long?) = apply { this.limit = limit } + + /** Number of pay statements to return (defaults to all). */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Number of pay statements to return (defaults to all). */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) /** Index to start from. */ - @JsonProperty("offset") fun offset(offset: Long) = apply { this.offset = offset } + fun offset(offset: Long?) = apply { this.offset = offset } + + /** Index to start from. */ + fun offset(offset: Long) = offset(offset as Long?) + + /** Index to start from. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Request = Request( checkNotNull(paymentId) { "`paymentId` is required but was not set" }, @@ -382,11 +404,11 @@ constructor( return true } - return /* spotless:off */ other is HrisPayStatementRetrieveManyParams && requests == other.requests && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is HrisPayStatementRetrieveManyParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(requests, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "HrisPayStatementRetrieveManyParams{requests=$requests, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "HrisPayStatementRetrieveManyParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index 94842363..8b7c0854 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.hris.PaymentService import java.util.Objects @@ -67,12 +68,13 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -126,10 +128,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index 13f61b41..f84e657c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.hris.PaymentServiceAsync import java.util.Objects @@ -74,12 +75,13 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,10 +135,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt index 19dd3c8c..66d261fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt @@ -16,8 +16,10 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** The end date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format. */ fun endDate(): LocalDate = endDate + /** The start date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format. */ fun startDate(): LocalDate = startDate fun _additionalHeaders(): Headers = additionalHeaders diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index bff3cbf8..e646a11b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -6,13 +6,13 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -23,25 +23,21 @@ import java.util.Optional * may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the * provider returns. */ -@JsonDeserialize(builder = Income.Builder::class) @NoAutoDetect class Income +@JsonCreator private constructor( - private val unit: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val effectiveDate: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("effective_date") + @ExcludeMissing + private val effectiveDate: JsonField = JsonMissing.of(), + @JsonProperty("unit") @ExcludeMissing private val unit: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** - * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, - * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. - */ - fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) - /** The income amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) @@ -56,7 +52,7 @@ private constructor( * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. */ - @JsonProperty("unit") @ExcludeMissing fun _unit() = unit + fun unit(): Optional = Optional.ofNullable(unit.getNullable("unit")) /** The income amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -67,16 +63,24 @@ private constructor( /** The date the income amount went into effect. */ @JsonProperty("effective_date") @ExcludeMissing fun _effectiveDate() = effectiveDate + /** + * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, + * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. + */ + @JsonProperty("unit") @ExcludeMissing fun _unit() = unit + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Income = apply { if (!validated) { - unit() amount() currency() effectiveDate() + unit() validated = true } } @@ -90,81 +94,78 @@ private constructor( class Builder { - private var unit: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var effectiveDate: JsonField = JsonMissing.of() + private var unit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(income: Income) = apply { - this.unit = income.unit - this.amount = income.amount - this.currency = income.currency - this.effectiveDate = income.effectiveDate - additionalProperties(income.additionalProperties) + amount = income.amount + currency = income.currency + effectiveDate = income.effectiveDate + unit = income.unit + additionalProperties = income.additionalProperties.toMutableMap() } - /** - * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, - * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. - */ - fun unit(unit: Unit) = unit(JsonField.of(unit)) - - /** - * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, - * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. - */ - @JsonProperty("unit") - @ExcludeMissing - fun unit(unit: JsonField) = apply { this.unit = unit } - /** The income amount in cents. */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** The income amount in cents. */ - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } /** The currency code. */ fun currency(currency: String) = currency(JsonField.of(currency)) /** The currency code. */ - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } /** The date the income amount went into effect. */ fun effectiveDate(effectiveDate: String) = effectiveDate(JsonField.of(effectiveDate)) /** The date the income amount went into effect. */ - @JsonProperty("effective_date") - @ExcludeMissing fun effectiveDate(effectiveDate: JsonField) = apply { this.effectiveDate = effectiveDate } + /** + * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, + * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. + */ + fun unit(unit: Unit) = unit(JsonField.of(unit)) + + /** + * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, + * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. + */ + fun unit(unit: JsonField) = apply { this.unit = unit } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Income = Income( - unit, amount, currency, effectiveDate, + unit, additionalProperties.toImmutable(), ) } @@ -273,15 +274,15 @@ private constructor( return true } - return /* spotless:off */ other is Income && unit == other.unit && amount == other.amount && currency == other.currency && effectiveDate == other.effectiveDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Income && amount == other.amount && currency == other.currency && effectiveDate == other.effectiveDate && unit == other.unit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(unit, amount, currency, effectiveDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, effectiveDate, unit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Income{unit=$unit, amount=$amount, currency=$currency, effectiveDate=$effectiveDate, additionalProperties=$additionalProperties}" + "Income{amount=$amount, currency=$currency, effectiveDate=$effectiveDate, unit=$unit, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index 13788acc..da66f032 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -6,68 +6,94 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Individual.Builder::class) @NoAutoDetect class Individual +@JsonCreator private constructor( - private val id: JsonField, - 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 residence: JsonField, - private val ssn: JsonField, - private val encryptedSsn: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + private val emails: JsonField> = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + private val encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + private val ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") + @ExcludeMissing + private val gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + private val phoneNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + private val preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + private val residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + + fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in + * the body. + */ + fun encryptedSsn(): Optional = + Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) + /** 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 gender of the individual. */ + fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) /** 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")) + /** The legal middle name of the individual. */ + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) 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")) + /** The preferred name of the individual. */ + fun preferredName(): Optional = + Optional.ofNullable(preferredName.getNullable("preferred_name")) fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) @@ -78,40 +104,39 @@ private constructor( */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("dob") @ExcludeMissing fun _dob() = dob + + @JsonProperty("emails") @ExcludeMissing fun _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. */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn() = encryptedSsn - /** A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity() = ethnicity /** 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 gender of the individual. */ + @JsonProperty("gender") @ExcludeMissing fun _gender() = gender /** 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 + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName @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 + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName() = preferredName @JsonProperty("residence") @ExcludeMissing fun _residence() = residence @@ -122,32 +147,27 @@ private constructor( */ @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 - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Individual = apply { if (!validated) { id() + dob() + emails().map { it.forEach { it.validate() } } + encryptedSsn() + ethnicity() firstName() - middleName() + gender() lastName() - preferredName() - emails().map { it.forEach { it.validate() } } + middleName() phoneNumbers().map { it.forEach { it?.validate() } } - gender() - ethnicity() - dob() + preferredName() residence().map { it.validate() } ssn() - encryptedSsn() validated = true } } @@ -162,119 +182,115 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var dob: JsonField = JsonMissing.of() + private var emails: JsonField> = JsonMissing.of() + private var encryptedSsn: JsonField = JsonMissing.of() + private var ethnicity: JsonField = JsonMissing.of() private var firstName: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() + private var gender: JsonField = JsonMissing.of() private var lastName: JsonField = JsonMissing.of() - private var preferredName: JsonField = JsonMissing.of() - private var emails: JsonField> = JsonMissing.of() + private var middleName: 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 preferredName: JsonField = JsonMissing.of() private var residence: JsonField = JsonMissing.of() private var ssn: JsonField = JsonMissing.of() - private var encryptedSsn: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individual: Individual) = apply { - this.id = individual.id - this.firstName = individual.firstName - this.middleName = individual.middleName - this.lastName = individual.lastName - this.preferredName = individual.preferredName - this.emails = individual.emails - this.phoneNumbers = individual.phoneNumbers - this.gender = individual.gender - this.ethnicity = individual.ethnicity - this.dob = individual.dob - this.residence = individual.residence - this.ssn = individual.ssn - this.encryptedSsn = individual.encryptedSsn - additionalProperties(individual.additionalProperties) + id = individual.id + dob = individual.dob + emails = individual.emails + encryptedSsn = individual.encryptedSsn + ethnicity = individual.ethnicity + firstName = individual.firstName + gender = individual.gender + lastName = individual.lastName + middleName = individual.middleName + phoneNumbers = individual.phoneNumbers + preferredName = individual.preferredName + residence = individual.residence + ssn = individual.ssn + additionalProperties = individual.additionalProperties.toMutableMap() } /** 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 id(id: JsonField) = apply { this.id = id } + + fun dob(dob: String) = dob(JsonField.of(dob)) + + fun dob(dob: JsonField) = apply { this.dob = dob } + + fun emails(emails: List) = emails(JsonField.of(emails)) + + fun emails(emails: JsonField>) = 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. + */ + 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. + */ + fun encryptedSsn(encryptedSsn: JsonField) = apply { + this.encryptedSsn = encryptedSsn + } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity) = ethnicity(JsonField.of(ethnicity)) + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } /** 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 gender of the individual. */ + fun gender(gender: Gender) = gender(JsonField.of(gender)) - /** The legal middle name of the individual. */ - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + /** The gender of the individual. */ + fun gender(gender: JsonField) = apply { this.gender = gender } /** 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)) + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) - @JsonProperty("emails") - @ExcludeMissing - fun emails(emails: JsonField>) = apply { this.emails = emails } + /** The legal middle name of the individual. */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } 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)) + /** The preferred name of the individual. */ + fun preferredName(preferredName: String) = preferredName(JsonField.of(preferredName)) - @JsonProperty("dob") - @ExcludeMissing - fun dob(dob: JsonField) = apply { this.dob = dob } + /** The preferred name of the individual. */ + fun preferredName(preferredName: JsonField) = apply { + this.preferredName = preferredName + } fun residence(residence: Location) = residence(JsonField.of(residence)) - @JsonProperty("residence") - @ExcludeMissing fun residence(residence: JsonField) = apply { this.residence = residence } /** @@ -289,72 +305,58 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - @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 additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Individual = Individual( id, + dob, + emails.map { it.toImmutable() }, + encryptedSsn, + ethnicity, firstName, - middleName, + gender, lastName, - preferredName, - emails.map { it.toImmutable() }, + middleName, phoneNumbers.map { it.toImmutable() }, - gender, - ethnicity, - dob, + preferredName, residence, ssn, - encryptedSsn, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Email.Builder::class) @NoAutoDetect class Email + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @@ -367,6 +369,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Email = apply { if (!validated) { data() @@ -390,37 +394,38 @@ private constructor( @JvmSynthetic internal fun from(email: Email) = apply { - this.data = email.data - this.type = email.type - additionalProperties(email.additionalProperties) + data = email.data + type = email.type + additionalProperties = email.additionalProperties.toMutableMap() } 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Email = Email( data, @@ -667,17 +672,18 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = PhoneNumber.Builder::class) @NoAutoDetect class PhoneNumber + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @@ -690,6 +696,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PhoneNumber = apply { if (!validated) { data() @@ -713,37 +721,38 @@ private constructor( @JvmSynthetic internal fun from(phoneNumber: PhoneNumber) = apply { - this.data = phoneNumber.data - this.type = phoneNumber.type - additionalProperties(phoneNumber.additionalProperties) + data = phoneNumber.data + type = phoneNumber.type + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PhoneNumber = PhoneNumber( data, @@ -832,15 +841,15 @@ private constructor( return true } - return /* spotless:off */ other is Individual && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && preferredName == other.preferredName && emails == other.emails && phoneNumbers == other.phoneNumbers && gender == other.gender && ethnicity == other.ethnicity && dob == other.dob && residence == other.residence && ssn == other.ssn && encryptedSsn == other.encryptedSsn && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Individual && id == other.id && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, preferredName, emails, phoneNumbers, gender, ethnicity, dob, residence, ssn, encryptedSsn, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Individual{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, preferredName=$preferredName, emails=$emails, phoneNumbers=$phoneNumbers, gender=$gender, ethnicity=$ethnicity, dob=$dob, residence=$residence, ssn=$ssn, encryptedSsn=$encryptedSsn, additionalProperties=$additionalProperties}" + "Individual{id=$id, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt index 00e6373e..5f0811f9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt @@ -6,52 +6,54 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = IndividualBenefit.Builder::class) @NoAutoDetect class IndividualBenefit +@JsonCreator private constructor( - private val individualId: JsonField, - private val code: JsonField, - private val body: JsonField, - private val additionalProperties: Map, + @JsonProperty("body") @ExcludeMissing private val body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun body(): Optional = Optional.ofNullable(body.getNullable("body")) fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + @JsonProperty("body") @ExcludeMissing fun _body() = body @JsonProperty("code") @ExcludeMissing fun _code() = code - @JsonProperty("body") @ExcludeMissing fun _body() = body + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): IndividualBenefit = apply { if (!validated) { - individualId() - code() body().map { it.validate() } + code() + individualId() validated = true } } @@ -65,82 +67,84 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() private var body: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individualBenefit: IndividualBenefit) = apply { - this.individualId = individualBenefit.individualId - this.code = individualBenefit.code - this.body = individualBenefit.body - additionalProperties(individualBenefit.additionalProperties) + body = individualBenefit.body + code = individualBenefit.code + individualId = individualBenefit.individualId + additionalProperties = individualBenefit.additionalProperties.toMutableMap() } - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + fun body(body: Body) = body(JsonField.of(body)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId - } + fun body(body: JsonField) = apply { this.body = body } fun code(code: Long) = code(JsonField.of(code)) - @JsonProperty("code") - @ExcludeMissing fun code(code: JsonField) = apply { this.code = code } - fun body(body: Body) = body(JsonField.of(body)) + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField) = apply { this.body = body } + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualBenefit = IndividualBenefit( - individualId, - code, body, + code, + individualId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Body.Builder::class) @NoAutoDetect class Body + @JsonCreator private constructor( - private val employeeDeduction: JsonField, - private val companyContribution: JsonField, - private val annualMaximum: JsonField, - private val catchUp: JsonField, - private val hsaContributionLimit: JsonField, - private val additionalProperties: Map, + @JsonProperty("annual_maximum") + @ExcludeMissing + private val annualMaximum: JsonField = JsonMissing.of(), + @JsonProperty("catch_up") + @ExcludeMissing + private val catchUp: JsonField = JsonMissing.of(), + @JsonProperty("company_contribution") + @ExcludeMissing + private val companyContribution: JsonField = JsonMissing.of(), + @JsonProperty("employee_deduction") + @ExcludeMissing + private val employeeDeduction: JsonField = JsonMissing.of(), + @JsonProperty("hsa_contribution_limit") + @ExcludeMissing + private val hsaContributionLimit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun employeeDeduction(): Optional = - Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) - - fun companyContribution(): Optional = - Optional.ofNullable(companyContribution.getNullable("company_contribution")) - /** If the benefit supports annual maximum, the amount in cents for this individual. */ fun annualMaximum(): Optional = Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) @@ -151,18 +155,16 @@ private constructor( */ fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + fun companyContribution(): Optional = + Optional.ofNullable(companyContribution.getNullable("company_contribution")) + + fun employeeDeduction(): Optional = + Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) + /** Type for HSA contribution limit if the benefit is a HSA. */ fun hsaContributionLimit(): Optional = Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) - @JsonProperty("employee_deduction") - @ExcludeMissing - fun _employeeDeduction() = employeeDeduction - - @JsonProperty("company_contribution") - @ExcludeMissing - fun _companyContribution() = companyContribution - /** If the benefit supports annual maximum, the amount in cents for this individual. */ @JsonProperty("annual_maximum") @ExcludeMissing fun _annualMaximum() = annualMaximum @@ -172,6 +174,14 @@ private constructor( */ @JsonProperty("catch_up") @ExcludeMissing fun _catchUp() = catchUp + @JsonProperty("company_contribution") + @ExcludeMissing + fun _companyContribution() = companyContribution + + @JsonProperty("employee_deduction") + @ExcludeMissing + fun _employeeDeduction() = employeeDeduction + /** Type for HSA contribution limit if the benefit is a HSA. */ @JsonProperty("hsa_contribution_limit") @ExcludeMissing @@ -181,12 +191,14 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Body = apply { if (!validated) { - employeeDeduction().map { it.validate() } - companyContribution().map { it.validate() } annualMaximum() catchUp() + companyContribution().map { it.validate() } + employeeDeduction().map { it.validate() } hsaContributionLimit() validated = true } @@ -201,47 +213,27 @@ private constructor( class Builder { - private var employeeDeduction: JsonField = JsonMissing.of() - private var companyContribution: JsonField = JsonMissing.of() private var annualMaximum: JsonField = JsonMissing.of() private var catchUp: JsonField = JsonMissing.of() + private var companyContribution: JsonField = JsonMissing.of() + private var employeeDeduction: JsonField = JsonMissing.of() private var hsaContributionLimit: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { - this.employeeDeduction = body.employeeDeduction - this.companyContribution = body.companyContribution - this.annualMaximum = body.annualMaximum - this.catchUp = body.catchUp - this.hsaContributionLimit = body.hsaContributionLimit - additionalProperties(body.additionalProperties) - } - - fun employeeDeduction(employeeDeduction: BenefitContribution) = - employeeDeduction(JsonField.of(employeeDeduction)) - - @JsonProperty("employee_deduction") - @ExcludeMissing - fun employeeDeduction(employeeDeduction: JsonField) = apply { - this.employeeDeduction = employeeDeduction - } - - fun companyContribution(companyContribution: BenefitContribution) = - companyContribution(JsonField.of(companyContribution)) - - @JsonProperty("company_contribution") - @ExcludeMissing - fun companyContribution(companyContribution: JsonField) = apply { - this.companyContribution = companyContribution + annualMaximum = body.annualMaximum + catchUp = body.catchUp + companyContribution = body.companyContribution + employeeDeduction = body.employeeDeduction + hsaContributionLimit = body.hsaContributionLimit + additionalProperties = body.additionalProperties.toMutableMap() } /** If the benefit supports annual maximum, the amount in cents for this individual. */ fun annualMaximum(annualMaximum: Long) = annualMaximum(JsonField.of(annualMaximum)) /** If the benefit supports annual maximum, the amount in cents for this individual. */ - @JsonProperty("annual_maximum") - @ExcludeMissing fun annualMaximum(annualMaximum: JsonField) = apply { this.annualMaximum = annualMaximum } @@ -256,17 +248,27 @@ private constructor( * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for * this individual. */ - @JsonProperty("catch_up") - @ExcludeMissing fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp } + fun companyContribution(companyContribution: BenefitContribution) = + companyContribution(JsonField.of(companyContribution)) + + fun companyContribution(companyContribution: JsonField) = apply { + this.companyContribution = companyContribution + } + + fun employeeDeduction(employeeDeduction: BenefitContribution) = + employeeDeduction(JsonField.of(employeeDeduction)) + + fun employeeDeduction(employeeDeduction: JsonField) = apply { + this.employeeDeduction = employeeDeduction + } + /** Type for HSA contribution limit if the benefit is a HSA. */ fun hsaContributionLimit(hsaContributionLimit: HsaContributionLimit) = hsaContributionLimit(JsonField.of(hsaContributionLimit)) /** Type for HSA contribution limit if the benefit is a HSA. */ - @JsonProperty("hsa_contribution_limit") - @ExcludeMissing fun hsaContributionLimit(hsaContributionLimit: JsonField) = apply { this.hsaContributionLimit = hsaContributionLimit @@ -274,24 +276,29 @@ private constructor( fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Body = Body( - employeeDeduction, - companyContribution, annualMaximum, catchUp, + companyContribution, + employeeDeduction, hsaContributionLimit, additionalProperties.toImmutable(), ) @@ -359,17 +366,17 @@ private constructor( return true } - return /* spotless:off */ other is Body && employeeDeduction == other.employeeDeduction && companyContribution == other.companyContribution && annualMaximum == other.annualMaximum && catchUp == other.catchUp && hsaContributionLimit == other.hsaContributionLimit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && annualMaximum == other.annualMaximum && catchUp == other.catchUp && companyContribution == other.companyContribution && employeeDeduction == other.employeeDeduction && hsaContributionLimit == other.hsaContributionLimit && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(employeeDeduction, companyContribution, annualMaximum, catchUp, hsaContributionLimit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(annualMaximum, catchUp, companyContribution, employeeDeduction, hsaContributionLimit, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{employeeDeduction=$employeeDeduction, companyContribution=$companyContribution, annualMaximum=$annualMaximum, catchUp=$catchUp, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}" + "Body{annualMaximum=$annualMaximum, catchUp=$catchUp, companyContribution=$companyContribution, employeeDeduction=$employeeDeduction, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -377,15 +384,15 @@ private constructor( return true } - return /* spotless:off */ other is IndividualBenefit && individualId == other.individualId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualBenefit && body == other.body && code == other.code && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, code, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, code, individualId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IndividualBenefit{individualId=$individualId, code=$code, body=$body, additionalProperties=$additionalProperties}" + "IndividualBenefit{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt index 15f09839..4a84938e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEnrolledIdsResponse.kt @@ -4,27 +4,30 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = IndividualEnrolledIdsResponse.Builder::class) @NoAutoDetect class IndividualEnrolledIdsResponse +@JsonCreator private constructor( - private val benefitId: JsonField, - private val individualIds: JsonField>, - private val additionalProperties: Map, + @JsonProperty("benefit_id") + @ExcludeMissing + private val benefitId: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun benefitId(): String = benefitId.getRequired("benefit_id") fun individualIds(): List = individualIds.getRequired("individual_ids") @@ -37,6 +40,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): IndividualEnrolledIdsResponse = apply { if (!validated) { benefitId() @@ -60,39 +65,40 @@ private constructor( @JvmSynthetic internal fun from(individualEnrolledIdsResponse: IndividualEnrolledIdsResponse) = apply { - this.benefitId = individualEnrolledIdsResponse.benefitId - this.individualIds = individualEnrolledIdsResponse.individualIds - additionalProperties(individualEnrolledIdsResponse.additionalProperties) + benefitId = individualEnrolledIdsResponse.benefitId + individualIds = individualEnrolledIdsResponse.individualIds + additionalProperties = individualEnrolledIdsResponse.additionalProperties.toMutableMap() } fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) - @JsonProperty("benefit_id") - @ExcludeMissing fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) - @JsonProperty("individual_ids") - @ExcludeMissing fun individualIds(individualIds: JsonField>) = apply { this.individualIds = individualIds } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualEnrolledIdsResponse = IndividualEnrolledIdsResponse( benefitId, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index f2bb419c..9d4bf162 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = IndividualEvent.Builder::class) @NoAutoDetect class IndividualEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): IndividualEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,108 +110,104 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individualEvent: IndividualEvent) = apply { - this.connectionId = individualEvent.connectionId - this.companyId = individualEvent.companyId - this.accountId = individualEvent.accountId - this.eventType = individualEvent.eventType - this.data = individualEvent.data - additionalProperties(individualEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = individualEvent.accountId + companyId = individualEvent.companyId + connectionId = individualEvent.connectionId + data = individualEvent.data + eventType = individualEvent.eventType + additionalProperties = individualEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualEvent = IndividualEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val individualId: JsonField, - private val additionalProperties: Map, + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The ID of the individual related to the event. */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) @@ -215,6 +219,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { individualId() @@ -236,34 +242,37 @@ private constructor( @JvmSynthetic internal fun from(data: Data) = apply { - this.individualId = data.individualId - additionalProperties(data.additionalProperties) + individualId = data.individualId + additionalProperties = data.additionalProperties.toMutableMap() } /** The ID of the individual related to the event. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** The ID of the individual related to the event. */ - @JsonProperty("individual_id") - @ExcludeMissing fun individualId(individualId: JsonField) = apply { this.individualId = individualId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data(individualId, additionalProperties.toImmutable()) } @@ -353,15 +362,15 @@ private constructor( return true } - return /* spotless:off */ other is IndividualEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IndividualEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "IndividualEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt index ab6cf71f..a985108a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualInDirectory.kt @@ -4,41 +4,56 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = IndividualInDirectory.Builder::class) @NoAutoDetect class IndividualInDirectory +@JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val manager: JsonField, - private val department: JsonField, - private val isActive: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** A stable Finch id (UUID v4) for an individual in the company. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** The department object. */ + fun department(): Optional = + Optional.ofNullable(department.getNullable("department")) + /** 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")) + /** `true` if the individual is an active employee or contractor at the company. */ + fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) /** The legal last name of the individual. */ fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name")) @@ -46,21 +61,20 @@ private constructor( /** The manager object. */ fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - /** The department object. */ - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) - - /** `true` if the individual is an active employee or contractor at the company. */ - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) + /** The legal middle name of the individual. */ + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) /** A stable Finch id (UUID v4) for an individual in the company. */ @JsonProperty("id") @ExcludeMissing fun _id() = id + /** The department object. */ + @JsonProperty("department") @ExcludeMissing fun _department() = department + /** 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 + /** `true` if the individual is an active employee or contractor at the company. */ + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive /** The legal last name of the individual. */ @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName @@ -68,25 +82,24 @@ private constructor( /** The manager object. */ @JsonProperty("manager") @ExcludeMissing fun _manager() = manager - /** The department object. */ - @JsonProperty("department") @ExcludeMissing fun _department() = department - - /** `true` if the individual is an active employee or contractor at the company. */ - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): IndividualInDirectory = apply { if (!validated) { id() + department().map { it.validate() } firstName() - middleName() + isActive() lastName() manager().map { it.validate() } - department().map { it.validate() } - isActive() + middleName() validated = true } } @@ -101,118 +114,112 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var department: JsonField = JsonMissing.of() private var firstName: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() + private var isActive: JsonField = JsonMissing.of() private var lastName: JsonField = JsonMissing.of() private var manager: JsonField = JsonMissing.of() - private var department: JsonField = JsonMissing.of() - private var isActive: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individualInDirectory: IndividualInDirectory) = apply { - this.id = individualInDirectory.id - this.firstName = individualInDirectory.firstName - this.middleName = individualInDirectory.middleName - this.lastName = individualInDirectory.lastName - this.manager = individualInDirectory.manager - this.department = individualInDirectory.department - this.isActive = individualInDirectory.isActive - additionalProperties(individualInDirectory.additionalProperties) + id = individualInDirectory.id + department = individualInDirectory.department + firstName = individualInDirectory.firstName + isActive = individualInDirectory.isActive + lastName = individualInDirectory.lastName + manager = individualInDirectory.manager + middleName = individualInDirectory.middleName + additionalProperties = individualInDirectory.additionalProperties.toMutableMap() } /** 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 id(id: JsonField) = apply { this.id = id } + + /** The department object. */ + fun department(department: Department) = department(JsonField.of(department)) + + /** The department object. */ + fun department(department: JsonField) = apply { this.department = department } /** 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)) + /** `true` if the individual is an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - /** The legal middle name of the individual. */ - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + /** `true` if the individual is an active employee or contractor at the company. */ + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } /** 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 manager object. */ fun manager(manager: Manager) = manager(JsonField.of(manager)) /** The manager object. */ - @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 } - - /** `true` if the individual is an active employee or contractor at the company. */ - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) - /** `true` if the individual is an active employee or contractor at the company. */ - @JsonProperty("is_active") - @ExcludeMissing - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + /** The legal middle name of the individual. */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualInDirectory = IndividualInDirectory( id, + department, firstName, - middleName, + isActive, lastName, manager, - department, - isActive, + middleName, additionalProperties.toImmutable(), ) } /** The department object. */ - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The name of the department. */ fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -223,6 +230,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -244,32 +253,35 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = department.additionalProperties.toMutableMap() } /** The name of the department. */ fun name(name: String) = name(JsonField.of(name)) /** The name of the department. */ - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -292,16 +304,15 @@ private constructor( } /** The manager object. */ - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -312,6 +323,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -333,32 +346,35 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } /** 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -384,15 +400,15 @@ private constructor( return true } - return /* spotless:off */ other is IndividualInDirectory && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && manager == other.manager && department == other.department && isActive == other.isActive && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualInDirectory && id == other.id && department == other.department && firstName == other.firstName && isActive == other.isActive && lastName == other.lastName && manager == other.manager && middleName == other.middleName && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, manager, department, isActive, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, department, firstName, isActive, lastName, manager, middleName, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IndividualInDirectory{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, manager=$manager, department=$department, isActive=$isActive, additionalProperties=$additionalProperties}" + "IndividualInDirectory{id=$id, department=$department, firstName=$firstName, isActive=$isActive, lastName=$lastName, manager=$manager, middleName=$middleName, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index 6c842ba5..d40abc77 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -4,51 +4,56 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = IndividualResponse.Builder::class) @NoAutoDetect class IndividualResponse +@JsonCreator private constructor( - private val individualId: JsonField, - private val code: JsonField, - private val body: JsonField, - private val additionalProperties: Map, + @JsonProperty("body") + @ExcludeMissing + private val body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun body(): Optional = Optional.ofNullable(body.getNullable("body")) fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + @JsonProperty("body") @ExcludeMissing fun _body() = body @JsonProperty("code") @ExcludeMissing fun _code() = code - @JsonProperty("body") @ExcludeMissing fun _body() = body + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): IndividualResponse = apply { if (!validated) { - individualId() - code() body().map { it.validate() } + code() + individualId() validated = true } } @@ -62,58 +67,57 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() private var body: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individualResponse: IndividualResponse) = apply { - this.individualId = individualResponse.individualId - this.code = individualResponse.code - this.body = individualResponse.body - additionalProperties(individualResponse.additionalProperties) + body = individualResponse.body + code = individualResponse.code + individualId = individualResponse.individualId + additionalProperties = individualResponse.additionalProperties.toMutableMap() } - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + fun body(body: Individual) = body(JsonField.of(body)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId - } + fun body(body: JsonField) = apply { this.body = body } fun code(code: Long) = code(JsonField.of(code)) - @JsonProperty("code") - @ExcludeMissing fun code(code: JsonField) = apply { this.code = code } - fun body(body: Individual) = body(JsonField.of(body)) + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField) = apply { this.body = body } + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualResponse = IndividualResponse( - individualId, - code, body, + code, + individualId, additionalProperties.toImmutable(), ) } @@ -123,15 +127,15 @@ private constructor( return true } - return /* spotless:off */ other is IndividualResponse && individualId == other.individualId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualResponse && body == other.body && code == other.code && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, code, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, code, individualId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IndividualResponse{individualId=$individualId, code=$code, body=$body, additionalProperties=$additionalProperties}" + "IndividualResponse{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index 84d086e5..37ecff50 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -6,65 +6,96 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = IndividualUpdateResponse.Builder::class) @NoAutoDetect class IndividualUpdateResponse +@JsonCreator 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, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + private val emails: JsonField> = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + private val encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + private val ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") + @ExcludeMissing + private val gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + private val phoneNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + private val preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + private val residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") @ExcludeMissing private val ssn: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + + fun emails(): Optional> = Optional.ofNullable(emails.getNullable("emails")) + + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in + * the body. + */ + fun encryptedSsn(): Optional = + Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) /** 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 gender of the individual. */ + fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) /** 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")) + /** The legal middle name of the individual. */ + fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name")) 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")) + /** The preferred name of the individual. */ + fun preferredName(): Optional = + Optional.ofNullable(preferredName.getNullable("preferred_name")) - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) + fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) /** * Social Security Number of the individual. This field is only available with the `ssn` scope @@ -73,42 +104,41 @@ private constructor( */ fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + @JsonProperty("dob") @ExcludeMissing fun _dob() = dob + + @JsonProperty("emails") @ExcludeMissing fun _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. */ - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) - - fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn() = encryptedSsn - /** A stable Finch `id` (UUID v4) for an individual in the company. */ - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity() = ethnicity /** 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 gender of the individual. */ + @JsonProperty("gender") @ExcludeMissing fun _gender() = gender /** 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 + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName @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 + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName() = preferredName - @JsonProperty("dob") @ExcludeMissing fun _dob() = dob + @JsonProperty("residence") @ExcludeMissing fun _residence() = residence /** * Social Security Number of the individual. This field is only available with the `ssn` scope @@ -117,37 +147,27 @@ private constructor( */ @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 + private var validated: Boolean = false + fun validate(): IndividualUpdateResponse = apply { if (!validated) { + id() + dob() + emails().map { it.forEach { it.validate() } } + encryptedSsn() + ethnicity() firstName() - middleName() + gender() lastName() - preferredName() - emails().map { it.forEach { it.validate() } } + middleName() phoneNumbers().map { it.forEach { it?.validate() } } - gender() - ethnicity() - dob() - ssn() - encryptedSsn() + preferredName() residence().map { it.validate() } - id() + ssn() validated = true } } @@ -161,109 +181,117 @@ private constructor( class Builder { + private var id: JsonField = JsonMissing.of() + private var dob: JsonField = JsonMissing.of() + private var emails: JsonField> = JsonMissing.of() + private var encryptedSsn: JsonField = JsonMissing.of() + private var ethnicity: JsonField = JsonMissing.of() private var firstName: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() + private var gender: JsonField = JsonMissing.of() private var lastName: JsonField = JsonMissing.of() - private var preferredName: JsonField = JsonMissing.of() - private var emails: JsonField> = JsonMissing.of() + private var middleName: 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 preferredName: JsonField = JsonMissing.of() private var residence: JsonField = JsonMissing.of() - private var id: JsonField = JsonMissing.of() + private var ssn: 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) + id = individualUpdateResponse.id + dob = individualUpdateResponse.dob + emails = individualUpdateResponse.emails + encryptedSsn = individualUpdateResponse.encryptedSsn + ethnicity = individualUpdateResponse.ethnicity + firstName = individualUpdateResponse.firstName + gender = individualUpdateResponse.gender + lastName = individualUpdateResponse.lastName + middleName = individualUpdateResponse.middleName + phoneNumbers = individualUpdateResponse.phoneNumbers + preferredName = individualUpdateResponse.preferredName + residence = individualUpdateResponse.residence + ssn = individualUpdateResponse.ssn + additionalProperties = individualUpdateResponse.additionalProperties.toMutableMap() } + /** 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. */ + fun id(id: JsonField) = apply { this.id = id } + + fun dob(dob: String) = dob(JsonField.of(dob)) + + fun dob(dob: JsonField) = apply { this.dob = dob } + + fun emails(emails: List) = emails(JsonField.of(emails)) + + fun emails(emails: JsonField>) = 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. + */ + 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. + */ + fun encryptedSsn(encryptedSsn: JsonField) = apply { + this.encryptedSsn = encryptedSsn + } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity) = ethnicity(JsonField.of(ethnicity)) + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } + /** 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 gender of the individual. */ + fun gender(gender: Gender) = gender(JsonField.of(gender)) - /** The legal middle name of the individual. */ - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { this.middleName = middleName } + /** The gender of the individual. */ + fun gender(gender: JsonField) = apply { this.gender = gender } /** 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)) + /** The legal middle name of the individual. */ + fun middleName(middleName: String) = middleName(JsonField.of(middleName)) - @JsonProperty("emails") - @ExcludeMissing - fun emails(emails: JsonField>) = apply { this.emails = emails } + /** The legal middle name of the individual. */ + fun middleName(middleName: JsonField) = apply { this.middleName = middleName } 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 preferred name of the individual. */ + fun preferredName(preferredName: String) = preferredName(JsonField.of(preferredName)) - /** The EEOC-defined ethnicity of the individual. */ - @JsonProperty("ethnicity") - @ExcludeMissing - fun ethnicity(ethnicity: JsonField) = apply { this.ethnicity = ethnicity } + /** The preferred name of the individual. */ + fun preferredName(preferredName: JsonField) = apply { + this.preferredName = preferredName + } - fun dob(dob: String) = dob(JsonField.of(dob)) + fun residence(residence: Location) = residence(JsonField.of(residence)) - @JsonProperty("dob") - @ExcludeMissing - fun dob(dob: JsonField) = apply { this.dob = dob } + fun residence(residence: JsonField) = apply { this.residence = residence } /** * Social Security Number of the individual. This field is only available with the `ssn` @@ -277,84 +305,58 @@ private constructor( * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - @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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualUpdateResponse = IndividualUpdateResponse( + id, + dob, + emails.map { it.toImmutable() }, + encryptedSsn, + ethnicity, firstName, - middleName, + gender, lastName, - preferredName, - emails.map { it.toImmutable() }, + middleName, phoneNumbers.map { it.toImmutable() }, - gender, - ethnicity, - dob, - ssn, - encryptedSsn, + preferredName, residence, - id, + ssn, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Email.Builder::class) @NoAutoDetect class Email + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @@ -367,6 +369,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Email = apply { if (!validated) { data() @@ -390,37 +394,38 @@ private constructor( @JvmSynthetic internal fun from(email: Email) = apply { - this.data = email.data - this.type = email.type - additionalProperties(email.additionalProperties) + data = email.data + type = email.type + additionalProperties = email.additionalProperties.toMutableMap() } 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Email = Email( data, @@ -667,17 +672,18 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = PhoneNumber.Builder::class) @NoAutoDetect class PhoneNumber + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @@ -690,6 +696,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PhoneNumber = apply { if (!validated) { data() @@ -713,37 +721,38 @@ private constructor( @JvmSynthetic internal fun from(phoneNumber: PhoneNumber) = apply { - this.data = phoneNumber.data - this.type = phoneNumber.type - additionalProperties(phoneNumber.additionalProperties) + data = phoneNumber.data + type = phoneNumber.type + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PhoneNumber = PhoneNumber( data, @@ -832,15 +841,15 @@ private constructor( return true } - return /* spotless:off */ other is IndividualUpdateResponse && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && preferredName == other.preferredName && emails == other.emails && phoneNumbers == other.phoneNumbers && gender == other.gender && ethnicity == other.ethnicity && dob == other.dob && ssn == other.ssn && encryptedSsn == other.encryptedSsn && residence == other.residence && id == other.id && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualUpdateResponse && id == other.id && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstName, middleName, lastName, preferredName, emails, phoneNumbers, gender, ethnicity, dob, ssn, encryptedSsn, residence, id, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = 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}" + "IndividualUpdateResponse{id=$id, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } 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 e4203f0b..fe29212c 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 @@ -6,47 +6,81 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Introspection.Builder::class) @NoAutoDetect class Introspection +@JsonCreator private constructor( - private val connectionId: JsonField, - private val connectionStatus: JsonField, - private val clientId: JsonField, - private val clientType: JsonField, - private val connectionType: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val customerId: JsonField, - private val customerName: JsonField, - private val customerEmail: JsonField, - private val authenticationMethods: JsonField>, - private val products: JsonField>, - private val username: JsonField, - private val providerId: JsonField, - private val payrollProviderId: JsonField, - private val manual: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("authentication_methods") + @ExcludeMissing + private val authenticationMethods: JsonField> = JsonMissing.of(), + @JsonProperty("client_id") + @ExcludeMissing + private val clientId: JsonField = JsonMissing.of(), + @JsonProperty("client_type") + @ExcludeMissing + private val clientType: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("connection_status") + @ExcludeMissing + private val connectionStatus: JsonField = JsonMissing.of(), + @JsonProperty("connection_type") + @ExcludeMissing + private val connectionType: JsonField = JsonMissing.of(), + @JsonProperty("customer_email") + @ExcludeMissing + private val customerEmail: JsonField = JsonMissing.of(), + @JsonProperty("customer_id") + @ExcludeMissing + private val customerId: JsonField = JsonMissing.of(), + @JsonProperty("customer_name") + @ExcludeMissing + private val customerName: JsonField = JsonMissing.of(), + @JsonProperty("manual") + @ExcludeMissing + private val manual: JsonField = JsonMissing.of(), + @JsonProperty("payroll_provider_id") + @ExcludeMissing + private val payrollProviderId: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonProperty("provider_id") + @ExcludeMissing + private val providerId: JsonField = JsonMissing.of(), + @JsonProperty("username") + @ExcludeMissing + private val username: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The Finch UUID of the connection associated with the `access_token`. */ - fun connectionId(): String = connectionId.getRequired("connection_id") + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this + * account ID. + */ + fun accountId(): String = accountId.getRequired("account_id") - fun connectionStatus(): ConnectionStatus = connectionStatus.getRequired("connection_status") + fun authenticationMethods(): List = + authenticationMethods.getRequired("authentication_methods") /** The client ID of the application associated with the `access_token`. */ fun clientId(): String = clientId.getRequired("client_id") @@ -54,6 +88,17 @@ private constructor( /** The type of application associated with a token. */ fun clientType(): ClientType = clientType.getRequired("client_type") + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this + * company ID. + */ + fun companyId(): String = companyId.getRequired("company_id") + + /** The Finch UUID of the connection associated with the `access_token`. */ + fun connectionId(): String = connectionId.getRequired("connection_id") + + fun connectionStatus(): ConnectionStatus = connectionStatus.getRequired("connection_status") + /** * The type of the connection associated with the token. * - `provider` - connection to an external provider @@ -62,16 +107,11 @@ private constructor( fun connectionType(): ConnectionType = connectionType.getRequired("connection_type") /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this - * company ID. - */ - fun companyId(): String = companyId.getRequired("company_id") - - /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this - * account ID. + * The email of your customer you provided to Finch when a connect session was created for this + * connection. */ - fun accountId(): String = accountId.getRequired("account_id") + fun customerEmail(): Optional = + Optional.ofNullable(customerEmail.getNullable("customer_email")) /** * The ID of your customer you provided to Finch when a connect session was created for this @@ -87,39 +127,34 @@ private constructor( Optional.ofNullable(customerName.getNullable("customer_name")) /** - * The email of your customer you provided to Finch when a connect session was created for this - * connection. + * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. + * (`true` if using Assisted Connect, `false` if connection is automated) */ - fun customerEmail(): Optional = - Optional.ofNullable(customerEmail.getNullable("customer_email")) + fun manual(): Boolean = manual.getRequired("manual") - fun authenticationMethods(): List = - authenticationMethods.getRequired("authentication_methods") + /** + * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID. + */ + fun payrollProviderId(): String = payrollProviderId.getRequired("payroll_provider_id") /** An array of the authorized products associated with the `access_token`. */ fun products(): List = products.getRequired("products") - /** The account username used for login associated with the `access_token`. */ - fun username(): String = username.getRequired("username") - /** The ID of the provider associated with the `access_token`. */ fun providerId(): String = providerId.getRequired("provider_id") - /** - * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID. - */ - fun payrollProviderId(): String = payrollProviderId.getRequired("payroll_provider_id") + /** The account username used for login associated with the `access_token`. */ + fun username(): String = username.getRequired("username") /** - * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. - * (`true` if using Assisted Connect, `false` if connection is automated) + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this + * account ID. */ - fun manual(): Boolean = manual.getRequired("manual") - - /** The Finch UUID of the connection associated with the `access_token`. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId - @JsonProperty("connection_status") @ExcludeMissing fun _connectionStatus() = connectionStatus + @JsonProperty("authentication_methods") + @ExcludeMissing + fun _authenticationMethods() = authenticationMethods /** The client ID of the application associated with the `access_token`. */ @JsonProperty("client_id") @ExcludeMissing fun _clientId() = clientId @@ -127,6 +162,17 @@ private constructor( /** The type of application associated with a token. */ @JsonProperty("client_type") @ExcludeMissing fun _clientType() = clientType + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this + * company ID. + */ + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + + /** The Finch UUID of the connection associated with the `access_token`. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + + @JsonProperty("connection_status") @ExcludeMissing fun _connectionStatus() = connectionStatus + /** * The type of the connection associated with the token. * - `provider` - connection to an external provider @@ -135,16 +181,10 @@ private constructor( @JsonProperty("connection_type") @ExcludeMissing fun _connectionType() = connectionType /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this - * company ID. - */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - - /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of this - * account ID. + * The email of your customer you provided to Finch when a connect session was created for this + * connection. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("customer_email") @ExcludeMissing fun _customerEmail() = customerEmail /** * The ID of your customer you provided to Finch when a connect session was created for this @@ -159,59 +199,51 @@ private constructor( @JsonProperty("customer_name") @ExcludeMissing fun _customerName() = customerName /** - * The email of your customer you provided to Finch when a connect session was created for this - * connection. + * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. + * (`true` if using Assisted Connect, `false` if connection is automated) */ - @JsonProperty("customer_email") @ExcludeMissing fun _customerEmail() = customerEmail + @JsonProperty("manual") @ExcludeMissing fun _manual() = manual - @JsonProperty("authentication_methods") + /** + * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID. + */ + @JsonProperty("payroll_provider_id") @ExcludeMissing - fun _authenticationMethods() = authenticationMethods + fun _payrollProviderId() = payrollProviderId /** An array of the authorized products associated with the `access_token`. */ @JsonProperty("products") @ExcludeMissing fun _products() = products - /** The account username used for login associated with the `access_token`. */ - @JsonProperty("username") @ExcludeMissing fun _username() = username - /** The ID of the provider associated with the `access_token`. */ @JsonProperty("provider_id") @ExcludeMissing fun _providerId() = providerId - /** - * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID. - */ - @JsonProperty("payroll_provider_id") - @ExcludeMissing - fun _payrollProviderId() = payrollProviderId - - /** - * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. - * (`true` if using Assisted Connect, `false` if connection is automated) - */ - @JsonProperty("manual") @ExcludeMissing fun _manual() = manual + /** The account username used for login associated with the `access_token`. */ + @JsonProperty("username") @ExcludeMissing fun _username() = username @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Introspection = apply { if (!validated) { - connectionId() - connectionStatus().validate() + accountId() + authenticationMethods().forEach { it.validate() } clientId() clientType() - connectionType() companyId() - accountId() + connectionId() + connectionStatus().validate() + connectionType() + customerEmail() customerId() customerName() - customerEmail() - authenticationMethods().forEach { it.validate() } + manual() + payrollProviderId() products() - username() providerId() - payrollProviderId() - manual() + username() validated = true } } @@ -225,80 +257,104 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var connectionStatus: JsonField = JsonMissing.of() + private var accountId: JsonField = JsonMissing.of() + private var authenticationMethods: JsonField> = JsonMissing.of() private var clientId: JsonField = JsonMissing.of() private var clientType: JsonField = JsonMissing.of() - private var connectionType: JsonField = JsonMissing.of() private var companyId: JsonField = JsonMissing.of() - private var accountId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() + private var connectionStatus: JsonField = JsonMissing.of() + private var connectionType: JsonField = JsonMissing.of() + private var customerEmail: JsonField = JsonMissing.of() private var customerId: JsonField = JsonMissing.of() private var customerName: JsonField = JsonMissing.of() - private var customerEmail: JsonField = JsonMissing.of() - private var authenticationMethods: JsonField> = JsonMissing.of() + private var manual: JsonField = JsonMissing.of() + private var payrollProviderId: JsonField = JsonMissing.of() private var products: JsonField> = JsonMissing.of() - private var username: JsonField = JsonMissing.of() private var providerId: JsonField = JsonMissing.of() - private var payrollProviderId: JsonField = JsonMissing.of() - private var manual: JsonField = JsonMissing.of() + private var username: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(introspection: Introspection) = apply { - this.connectionId = introspection.connectionId - this.connectionStatus = introspection.connectionStatus - this.clientId = introspection.clientId - this.clientType = introspection.clientType - this.connectionType = introspection.connectionType - this.companyId = introspection.companyId - this.accountId = introspection.accountId - this.customerId = introspection.customerId - this.customerName = introspection.customerName - this.customerEmail = introspection.customerEmail - this.authenticationMethods = introspection.authenticationMethods - this.products = introspection.products - this.username = introspection.username - this.providerId = introspection.providerId - this.payrollProviderId = introspection.payrollProviderId - this.manual = introspection.manual - additionalProperties(introspection.additionalProperties) + accountId = introspection.accountId + authenticationMethods = introspection.authenticationMethods + clientId = introspection.clientId + clientType = introspection.clientType + companyId = introspection.companyId + connectionId = introspection.connectionId + connectionStatus = introspection.connectionStatus + connectionType = introspection.connectionType + customerEmail = introspection.customerEmail + customerId = introspection.customerId + customerName = introspection.customerName + manual = introspection.manual + payrollProviderId = introspection.payrollProviderId + products = introspection.products + providerId = introspection.providerId + username = introspection.username + additionalProperties = introspection.additionalProperties.toMutableMap() } - /** The Finch UUID of the connection associated with the `access_token`. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of + * this account ID. + */ + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) - /** The Finch UUID of the connection associated with the `access_token`. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId - } + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of + * this account ID. + */ + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } - fun connectionStatus(connectionStatus: ConnectionStatus) = - connectionStatus(JsonField.of(connectionStatus)) + fun authenticationMethods(authenticationMethods: List) = + authenticationMethods(JsonField.of(authenticationMethods)) - @JsonProperty("connection_status") - @ExcludeMissing - fun connectionStatus(connectionStatus: JsonField) = apply { - this.connectionStatus = connectionStatus - } + fun authenticationMethods(authenticationMethods: JsonField>) = + apply { + this.authenticationMethods = authenticationMethods + } /** The client ID of the application associated with the `access_token`. */ fun clientId(clientId: String) = clientId(JsonField.of(clientId)) /** The client ID of the application associated with the `access_token`. */ - @JsonProperty("client_id") - @ExcludeMissing fun clientId(clientId: JsonField) = apply { this.clientId = clientId } /** The type of application associated with a token. */ fun clientType(clientType: ClientType) = clientType(JsonField.of(clientType)) /** The type of application associated with a token. */ - @JsonProperty("client_type") - @ExcludeMissing fun clientType(clientType: JsonField) = apply { this.clientType = clientType } + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of + * this company ID. + */ + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + + /** + * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of + * this company ID. + */ + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** The Finch UUID of the connection associated with the `access_token`. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) + + /** The Finch UUID of the connection associated with the `access_token`. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } + + fun connectionStatus(connectionStatus: ConnectionStatus) = + connectionStatus(JsonField.of(connectionStatus)) + + fun connectionStatus(connectionStatus: JsonField) = apply { + this.connectionStatus = connectionStatus + } + /** * The type of the connection associated with the token. * - `provider` - connection to an external provider @@ -312,39 +368,23 @@ private constructor( * - `provider` - connection to an external provider * - `finch` - finch-generated data. */ - @JsonProperty("connection_type") - @ExcludeMissing fun connectionType(connectionType: JsonField) = apply { this.connectionType = connectionType } /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of - * this company ID. - */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) - - /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of - * this company ID. - */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - - /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of - * this account ID. + * The email of your customer you provided to Finch when a connect session was created for + * this connection. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun customerEmail(customerEmail: String) = customerEmail(JsonField.of(customerEmail)) /** - * [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection instead of - * this account ID. + * The email of your customer you provided to Finch when a connect session was created for + * this connection. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun customerEmail(customerEmail: JsonField) = apply { + this.customerEmail = customerEmail + } /** * The ID of your customer you provided to Finch when a connect session was created for this @@ -356,8 +396,6 @@ private constructor( * The ID of your customer you provided to Finch when a connect session was created for this * connection. */ - @JsonProperty("customer_id") - @ExcludeMissing fun customerId(customerId: JsonField) = apply { this.customerId = customerId } /** @@ -370,61 +408,21 @@ private constructor( * The name of your customer you provided to Finch when a connect session was created for * this connection. */ - @JsonProperty("customer_name") - @ExcludeMissing fun customerName(customerName: JsonField) = apply { this.customerName = customerName } /** - * The email of your customer you provided to Finch when a connect session was created for - * this connection. + * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. + * (`true` if using Assisted Connect, `false` if connection is automated) */ - fun customerEmail(customerEmail: String) = customerEmail(JsonField.of(customerEmail)) + fun manual(manual: Boolean) = manual(JsonField.of(manual)) /** - * The email of your customer you provided to Finch when a connect session was created for - * this connection. + * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. + * (`true` if using Assisted Connect, `false` if connection is automated) */ - @JsonProperty("customer_email") - @ExcludeMissing - fun customerEmail(customerEmail: JsonField) = apply { - this.customerEmail = customerEmail - } - - fun authenticationMethods(authenticationMethods: List) = - 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)) - - /** An array of the authorized products associated with the `access_token`. */ - @JsonProperty("products") - @ExcludeMissing - fun products(products: JsonField>) = apply { this.products = products } - - /** The account username used for login associated with the `access_token`. */ - fun username(username: String) = username(JsonField.of(username)) - - /** The account username used for login associated with the `access_token`. */ - @JsonProperty("username") - @ExcludeMissing - fun username(username: JsonField) = apply { this.username = username } - - /** The ID of the provider associated with the `access_token`. */ - fun providerId(providerId: String) = providerId(JsonField.of(providerId)) - - /** The ID of the provider associated with the `access_token`. */ - @JsonProperty("provider_id") - @ExcludeMissing - fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + fun manual(manual: JsonField) = apply { this.manual = manual } /** * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider @@ -437,77 +435,84 @@ private constructor( * [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider * ID. */ - @JsonProperty("payroll_provider_id") - @ExcludeMissing fun payrollProviderId(payrollProviderId: JsonField) = apply { this.payrollProviderId = payrollProviderId } - /** - * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. - * (`true` if using Assisted Connect, `false` if connection is automated) - */ - fun manual(manual: Boolean) = manual(JsonField.of(manual)) + /** An array of the authorized products associated with the `access_token`. */ + fun products(products: List) = products(JsonField.of(products)) - /** - * Whether the connection associated with the `access_token` uses the Assisted Connect Flow. - * (`true` if using Assisted Connect, `false` if connection is automated) - */ - @JsonProperty("manual") - @ExcludeMissing - fun manual(manual: JsonField) = apply { this.manual = manual } + /** An array of the authorized products associated with the `access_token`. */ + fun products(products: JsonField>) = apply { this.products = products } + + /** The ID of the provider associated with the `access_token`. */ + fun providerId(providerId: String) = providerId(JsonField.of(providerId)) + + /** The ID of the provider associated with the `access_token`. */ + fun providerId(providerId: JsonField) = apply { this.providerId = providerId } + + /** The account username used for login associated with the `access_token`. */ + fun username(username: String) = username(JsonField.of(username)) + + /** The account username used for login associated with the `access_token`. */ + fun username(username: JsonField) = apply { this.username = username } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Introspection = Introspection( - connectionId, - connectionStatus, + accountId, + authenticationMethods.map { it.toImmutable() }, clientId, clientType, - connectionType, companyId, - accountId, + connectionId, + connectionStatus, + connectionType, + customerEmail, customerId, customerName, - customerEmail, - authenticationMethods.map { it.toImmutable() }, + manual, + payrollProviderId, products.map { it.toImmutable() }, - username, providerId, - payrollProviderId, - manual, + username, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = AuthenticationMethod.Builder::class) @NoAutoDetect class AuthenticationMethod + @JsonCreator private constructor( - private val type: JsonField, - private val connectionStatus: JsonField, - private val products: JsonField>, - private val additionalProperties: Map, + @JsonProperty("connection_status") + @ExcludeMissing + private val connectionStatus: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The type of authentication method. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun connectionStatus(): Optional = Optional.ofNullable(connectionStatus.getNullable("connection_status")) @@ -516,7 +521,7 @@ private constructor( Optional.ofNullable(products.getNullable("products")) /** The type of authentication method. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @JsonProperty("connection_status") @ExcludeMissing @@ -525,15 +530,20 @@ private constructor( /** An array of the authorized products associated with the `access_token`. */ @JsonProperty("products") @ExcludeMissing fun _products() = products + /** The type of authentication method. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AuthenticationMethod = apply { if (!validated) { - type() connectionStatus().map { it.validate() } products() + type() validated = true } } @@ -547,32 +557,22 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var connectionStatus: JsonField = JsonMissing.of() private var products: JsonField> = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(authenticationMethod: AuthenticationMethod) = apply { - this.type = authenticationMethod.type - this.connectionStatus = authenticationMethod.connectionStatus - this.products = authenticationMethod.products - additionalProperties(authenticationMethod.additionalProperties) + connectionStatus = authenticationMethod.connectionStatus + products = authenticationMethod.products + type = authenticationMethod.type + additionalProperties = authenticationMethod.additionalProperties.toMutableMap() } - /** The type of authentication method. */ - fun type(type: Type) = type(JsonField.of(type)) - - /** The type of authentication method. */ - @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 } @@ -581,61 +581,75 @@ private constructor( fun products(products: List) = products(JsonField.of(products)) /** An array of the authorized products associated with the `access_token`. */ - @JsonProperty("products") - @ExcludeMissing fun products(products: JsonField>) = apply { this.products = products } + /** The type of authentication method. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The type of authentication method. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AuthenticationMethod = AuthenticationMethod( - type, connectionStatus, products.map { it.toImmutable() }, + type, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = ConnectionStatus.Builder::class) @NoAutoDetect class ConnectionStatus + @JsonCreator private constructor( - private val status: JsonField, - private val message: JsonField, - private val additionalProperties: Map, + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun message(): Optional = Optional.ofNullable(message.getNullable("message")) fun status(): Optional = Optional.ofNullable(status.getNullable("status")) - fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + @JsonProperty("message") @ExcludeMissing fun _message() = message @JsonProperty("status") @ExcludeMissing fun _status() = status - @JsonProperty("message") @ExcludeMissing fun _message() = message - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ConnectionStatus = apply { if (!validated) { - status() message() + status() validated = true } } @@ -649,37 +663,32 @@ private constructor( class Builder { - private var status: JsonField = JsonMissing.of() private var message: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectionStatus: ConnectionStatus) = apply { - this.status = connectionStatus.status - this.message = connectionStatus.message - additionalProperties(connectionStatus.additionalProperties) + message = connectionStatus.message + status = connectionStatus.status + additionalProperties = connectionStatus.additionalProperties.toMutableMap() } - fun status(status: ConnectionStatusType) = 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 status(status: ConnectionStatusType) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -687,10 +696,18 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ConnectionStatus = ConnectionStatus( - status, message, + status, additionalProperties.toImmutable(), ) } @@ -700,17 +717,17 @@ private constructor( return true } - return /* spotless:off */ other is ConnectionStatus && status == other.status && message == other.message && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ConnectionStatus && message == other.message && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(status, message, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(message, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ConnectionStatus{status=$status, message=$message, additionalProperties=$additionalProperties}" + "ConnectionStatus{message=$message, status=$status, additionalProperties=$additionalProperties}" } class Type @@ -793,17 +810,17 @@ private constructor( return true } - return /* spotless:off */ other is AuthenticationMethod && type == other.type && connectionStatus == other.connectionStatus && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AuthenticationMethod && connectionStatus == other.connectionStatus && products == other.products && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, connectionStatus, products, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(connectionStatus, products, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AuthenticationMethod{type=$type, connectionStatus=$connectionStatus, products=$products, additionalProperties=$additionalProperties}" + "AuthenticationMethod{connectionStatus=$connectionStatus, products=$products, type=$type, additionalProperties=$additionalProperties}" } class ClientType @@ -869,34 +886,39 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = ConnectionStatus.Builder::class) @NoAutoDetect class ConnectionStatus + @JsonCreator private constructor( - private val status: JsonField, - private val message: JsonField, - private val additionalProperties: Map, + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun message(): Optional = Optional.ofNullable(message.getNullable("message")) fun status(): Optional = Optional.ofNullable(status.getNullable("status")) - fun message(): Optional = Optional.ofNullable(message.getNullable("message")) + @JsonProperty("message") @ExcludeMissing fun _message() = message @JsonProperty("status") @ExcludeMissing fun _status() = status - @JsonProperty("message") @ExcludeMissing fun _message() = message - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ConnectionStatus = apply { if (!validated) { - status() message() + status() validated = true } } @@ -910,47 +932,48 @@ private constructor( class Builder { - private var status: JsonField = JsonMissing.of() private var message: JsonField = JsonMissing.of() + private var status: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(connectionStatus: ConnectionStatus) = apply { - this.status = connectionStatus.status - this.message = connectionStatus.message - additionalProperties(connectionStatus.additionalProperties) + message = connectionStatus.message + status = connectionStatus.status + additionalProperties = connectionStatus.additionalProperties.toMutableMap() } - fun status(status: ConnectionStatusType) = 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 status(status: ConnectionStatusType) = status(JsonField.of(status)) + + fun status(status: JsonField) = apply { this.status = status } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ConnectionStatus = ConnectionStatus( - status, message, + status, additionalProperties.toImmutable(), ) } @@ -960,17 +983,17 @@ private constructor( return true } - return /* spotless:off */ other is ConnectionStatus && status == other.status && message == other.message && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ConnectionStatus && message == other.message && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(status, message, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(message, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ConnectionStatus{status=$status, message=$message, additionalProperties=$additionalProperties}" + "ConnectionStatus{message=$message, status=$status, additionalProperties=$additionalProperties}" } class ConnectionType @@ -1035,15 +1058,15 @@ private constructor( return true } - return /* spotless:off */ other is Introspection && connectionId == other.connectionId && connectionStatus == other.connectionStatus && clientId == other.clientId && clientType == other.clientType && connectionType == other.connectionType && companyId == other.companyId && accountId == other.accountId && customerId == other.customerId && customerName == other.customerName && customerEmail == other.customerEmail && authenticationMethods == other.authenticationMethods && products == other.products && username == other.username && providerId == other.providerId && payrollProviderId == other.payrollProviderId && manual == other.manual && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Introspection && accountId == other.accountId && authenticationMethods == other.authenticationMethods && clientId == other.clientId && clientType == other.clientType && companyId == other.companyId && connectionId == other.connectionId && connectionStatus == other.connectionStatus && connectionType == other.connectionType && customerEmail == other.customerEmail && customerId == other.customerId && customerName == other.customerName && manual == other.manual && payrollProviderId == other.payrollProviderId && products == other.products && providerId == other.providerId && username == other.username && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, connectionStatus, clientId, clientType, connectionType, companyId, accountId, customerId, customerName, customerEmail, authenticationMethods, products, username, providerId, payrollProviderId, manual, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, authenticationMethods, clientId, clientType, companyId, connectionId, connectionStatus, connectionType, customerEmail, customerId, customerName, manual, payrollProviderId, products, providerId, username, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Introspection{connectionId=$connectionId, connectionStatus=$connectionStatus, clientId=$clientId, clientType=$clientType, connectionType=$connectionType, companyId=$companyId, accountId=$accountId, customerId=$customerId, customerName=$customerName, customerEmail=$customerEmail, authenticationMethods=$authenticationMethods, products=$products, username=$username, providerId=$providerId, payrollProviderId=$payrollProviderId, manual=$manual, additionalProperties=$additionalProperties}" + "Introspection{accountId=$accountId, authenticationMethods=$authenticationMethods, clientId=$clientId, clientType=$clientType, companyId=$companyId, connectionId=$connectionId, connectionStatus=$connectionStatus, connectionType=$connectionType, customerEmail=$customerEmail, customerId=$customerId, customerName=$customerName, manual=$manual, payrollProviderId=$payrollProviderId, products=$products, providerId=$providerId, username=$username, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index fc7ae8b8..a4a8f5ea 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -23,6 +23,7 @@ import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.getOrThrow import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -31,24 +32,20 @@ import kotlin.jvm.optionals.getOrNull class JobAutomatedCreateParams constructor( - private val dataSyncAll: DataSyncAll?, - private val w4FormEmployeeSync: W4FormEmployeeSync?, + private val body: JobAutomatedCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) { - fun dataSyncAll(): Optional = Optional.ofNullable(dataSyncAll) + fun dataSyncAll(): Optional = body.dataSyncAll() - fun w4FormEmployeeSync(): Optional = Optional.ofNullable(w4FormEmployeeSync) + fun w4FormEmployeeSync(): Optional = body.w4FormEmployeeSync() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic - internal fun getBody(): JobAutomatedCreateBody { - return JobAutomatedCreateBody(dataSyncAll, w4FormEmployeeSync) - } + @JvmSynthetic internal fun getBody(): JobAutomatedCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -180,27 +177,23 @@ constructor( @NoAutoDetect class Builder { - private var dataSyncAll: DataSyncAll? = null - private var w4FormEmployeeSync: W4FormEmployeeSync? = null + private var body: JobAutomatedCreateBody? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(jobAutomatedCreateParams: JobAutomatedCreateParams) = apply { - dataSyncAll = jobAutomatedCreateParams.dataSyncAll - w4FormEmployeeSync = jobAutomatedCreateParams.w4FormEmployeeSync + body = jobAutomatedCreateParams.body additionalHeaders = jobAutomatedCreateParams.additionalHeaders.toBuilder() additionalQueryParams = jobAutomatedCreateParams.additionalQueryParams.toBuilder() } fun forDataSyncAll(dataSyncAll: DataSyncAll) = apply { - this.dataSyncAll = dataSyncAll - this.w4FormEmployeeSync = null + body = JobAutomatedCreateBody.ofDataSyncAll(dataSyncAll) } fun forW4FormEmployeeSync(w4FormEmployeeSync: W4FormEmployeeSync) = apply { - this.dataSyncAll = null - this.w4FormEmployeeSync = w4FormEmployeeSync + body = JobAutomatedCreateBody.ofW4FormEmployeeSync(w4FormEmployeeSync) } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -303,23 +296,23 @@ constructor( fun build(): JobAutomatedCreateParams = JobAutomatedCreateParams( - dataSyncAll, - w4FormEmployeeSync, + body ?: JobAutomatedCreateBody(), additionalHeaders.build(), additionalQueryParams.build(), ) } - @JsonDeserialize(builder = DataSyncAll.Builder::class) @NoAutoDetect class DataSyncAll + @JsonCreator private constructor( - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("type") private val type: Type, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The type of job to start. */ - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Type = type @JsonAnyGetter @ExcludeMissing @@ -339,27 +332,32 @@ constructor( @JvmSynthetic internal fun from(dataSyncAll: DataSyncAll) = apply { - this.type = dataSyncAll.type - additionalProperties(dataSyncAll.additionalProperties) + type = dataSyncAll.type + additionalProperties = dataSyncAll.additionalProperties.toMutableMap() } /** The type of job to start. */ - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): DataSyncAll = DataSyncAll( checkNotNull(type) { "`type` is required but was not set" }, @@ -436,20 +434,21 @@ constructor( "DataSyncAll{type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = W4FormEmployeeSync.Builder::class) @NoAutoDetect class W4FormEmployeeSync + @JsonCreator private constructor( - private val type: Type?, - private val individualId: String?, - private val additionalProperties: Map, + @JsonProperty("individual_id") private val individualId: String, + @JsonProperty("type") private val type: Type, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The type of job to start. */ - @JsonProperty("type") fun type(): Type? = type - /** The unique ID of the individual for W-4 data sync. */ - @JsonProperty("individual_id") fun individualId(): String? = individualId + @JsonProperty("individual_id") fun individualId(): String = individualId + + /** The type of job to start. */ + @JsonProperty("type") fun type(): Type = type @JsonAnyGetter @ExcludeMissing @@ -464,42 +463,46 @@ constructor( class Builder { - private var type: Type? = null private var individualId: String? = null + private var type: Type? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(w4FormEmployeeSync: W4FormEmployeeSync) = apply { - this.type = w4FormEmployeeSync.type - this.individualId = w4FormEmployeeSync.individualId - additionalProperties(w4FormEmployeeSync.additionalProperties) + individualId = w4FormEmployeeSync.individualId + type = w4FormEmployeeSync.type + additionalProperties = w4FormEmployeeSync.additionalProperties.toMutableMap() } - /** The type of job to start. */ - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } - /** The unique ID of the individual for W-4 data sync. */ - @JsonProperty("individual_id") fun individualId(individualId: String) = apply { this.individualId = individualId } + /** The type of job to start. */ + fun type(type: Type) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): W4FormEmployeeSync = W4FormEmployeeSync( - checkNotNull(type) { "`type` is required but was not set" }, checkNotNull(individualId) { "`individualId` is required but was not set" }, + checkNotNull(type) { "`type` is required but was not set" }, additionalProperties.toImmutable(), ) } @@ -560,17 +563,17 @@ constructor( return true } - return /* spotless:off */ other is W4FormEmployeeSync && type == other.type && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is W4FormEmployeeSync && individualId == other.individualId && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, individualId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(individualId, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "W4FormEmployeeSync{type=$type, individualId=$individualId, additionalProperties=$additionalProperties}" + "W4FormEmployeeSync{individualId=$individualId, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -578,11 +581,11 @@ constructor( return true } - return /* spotless:off */ other is JobAutomatedCreateParams && dataSyncAll == other.dataSyncAll && w4FormEmployeeSync == other.w4FormEmployeeSync && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is JobAutomatedCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(dataSyncAll, w4FormEmployeeSync, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "JobAutomatedCreateParams{dataSyncAll=$dataSyncAll, w4FormEmployeeSync=$w4FormEmployeeSync, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "JobAutomatedCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt index a83fe3eb..d6048527 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.jobs.AutomatedService import java.util.Objects @@ -82,13 +83,15 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val data: JsonField>, - private val paging: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + private val data: JsonField> = JsonMissing.of(), + @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -150,15 +153,12 @@ private constructor( fun data(data: List) = data(JsonField.of(data)) - @JsonProperty("data") fun data(data: JsonField>) = apply { this.data = data } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") fun paging(paging: JsonField) = apply { this.paging = paging } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt index aca6d42c..a580d6b8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.jobs.AutomatedServiceAsync import java.util.Objects @@ -85,13 +86,15 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val data: JsonField>, - private val paging: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + private val data: JsonField> = JsonMissing.of(), + @JsonProperty("paging") private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -153,15 +156,12 @@ private constructor( fun data(data: List) = data(JsonField.of(data)) - @JsonProperty("data") fun data(data: JsonField>) = apply { this.data = data } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") fun paging(paging: JsonField) = apply { this.paging = paging } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt index 3eb94cf4..a86984ab 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListParams.kt @@ -16,8 +16,10 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** Number of items to return */ fun limit(): Optional = Optional.ofNullable(limit) + /** Index to start from (defaults to 0) */ fun offset(): Optional = Optional.ofNullable(offset) fun _additionalHeaders(): Headers = additionalHeaders @@ -59,10 +61,24 @@ constructor( } /** Number of items to return */ - fun limit(limit: Long) = apply { this.limit = limit } + fun limit(limit: Long?) = apply { this.limit = limit } + + /** Number of items to return */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Number of items to return */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long?) = apply { this.offset = offset } + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long) = offset(offset as Long?) /** Index to start from (defaults to 0) */ - fun offset(offset: Long) = apply { this.offset = offset } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index ffc7fa45..16487802 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = JobCompletionEvent.Builder::class) @NoAutoDetect class JobCompletionEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): JobCompletionEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,109 +110,107 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(jobCompletionEvent: JobCompletionEvent) = apply { - this.connectionId = jobCompletionEvent.connectionId - this.companyId = jobCompletionEvent.companyId - this.accountId = jobCompletionEvent.accountId - this.eventType = jobCompletionEvent.eventType - this.data = jobCompletionEvent.data - additionalProperties(jobCompletionEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = jobCompletionEvent.accountId + companyId = jobCompletionEvent.companyId + connectionId = jobCompletionEvent.connectionId + data = jobCompletionEvent.data + eventType = jobCompletionEvent.eventType + additionalProperties = jobCompletionEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): JobCompletionEvent = JobCompletionEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val jobId: JsonField, - private val jobUrl: JsonField, - private val additionalProperties: Map, + @JsonProperty("job_id") + @ExcludeMissing + private val jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") + @ExcludeMissing + private val jobUrl: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The id of the job which has completed. */ fun jobId(): String = jobId.getRequired("job_id") @@ -221,6 +227,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { jobId() @@ -244,41 +252,42 @@ private constructor( @JvmSynthetic internal fun from(data: Data) = apply { - this.jobId = data.jobId - this.jobUrl = data.jobUrl - additionalProperties(data.additionalProperties) + jobId = data.jobId + jobUrl = data.jobUrl + additionalProperties = data.additionalProperties.toMutableMap() } /** The id of the job which has completed. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) /** The id of the job which has completed. */ - @JsonProperty("job_id") - @ExcludeMissing fun jobId(jobId: JsonField) = apply { this.jobId = jobId } /** The url to query the result of the job. */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) /** The url to query the result of the job. */ - @JsonProperty("job_url") - @ExcludeMissing fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data( jobId, @@ -391,15 +400,15 @@ private constructor( return true } - return /* spotless:off */ other is JobCompletionEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is JobCompletionEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "JobCompletionEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "JobCompletionEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt index 6376d9e4..595a71c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCreateResponse.kt @@ -4,28 +4,36 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = JobCreateResponse.Builder::class) @NoAutoDetect class JobCreateResponse +@JsonCreator private constructor( - private val jobId: JsonField, - private val jobUrl: JsonField, - private val allowedRefreshes: JsonField, - private val remainingRefreshes: JsonField, - private val additionalProperties: Map, + @JsonProperty("allowed_refreshes") + @ExcludeMissing + private val allowedRefreshes: JsonField = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), + @JsonProperty("job_url") + @ExcludeMissing + private val jobUrl: JsonField = JsonMissing.of(), + @JsonProperty("remaining_refreshes") + @ExcludeMissing + private val remainingRefreshes: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The number of allowed refreshes per hour (per hour, fixed window) */ + fun allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes") /** The id of the job that has been created. */ fun jobId(): String = jobId.getRequired("job_id") @@ -33,21 +41,18 @@ private constructor( /** The url that can be used to retrieve the job status */ fun jobUrl(): String = jobUrl.getRequired("job_url") - /** The number of allowed refreshes per hour (per hour, fixed window) */ - fun allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes") - /** The number of remaining refreshes available (per hour, fixed window) */ fun remainingRefreshes(): Long = remainingRefreshes.getRequired("remaining_refreshes") + /** The number of allowed refreshes per hour (per hour, fixed window) */ + @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes() = allowedRefreshes + /** The id of the job that has been created. */ @JsonProperty("job_id") @ExcludeMissing fun _jobId() = jobId /** The url that can be used to retrieve the job status */ @JsonProperty("job_url") @ExcludeMissing fun _jobUrl() = jobUrl - /** The number of allowed refreshes per hour (per hour, fixed window) */ - @JsonProperty("allowed_refreshes") @ExcludeMissing fun _allowedRefreshes() = allowedRefreshes - /** The number of remaining refreshes available (per hour, fixed window) */ @JsonProperty("remaining_refreshes") @ExcludeMissing @@ -57,11 +62,13 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): JobCreateResponse = apply { if (!validated) { + allowedRefreshes() jobId() jobUrl() - allowedRefreshes() remainingRefreshes() validated = true } @@ -76,78 +83,75 @@ private constructor( class Builder { + private var allowedRefreshes: JsonField = JsonMissing.of() private var jobId: JsonField = JsonMissing.of() private var jobUrl: JsonField = JsonMissing.of() - private var allowedRefreshes: JsonField = JsonMissing.of() private var remainingRefreshes: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(jobCreateResponse: JobCreateResponse) = apply { - this.jobId = jobCreateResponse.jobId - this.jobUrl = jobCreateResponse.jobUrl - this.allowedRefreshes = jobCreateResponse.allowedRefreshes - this.remainingRefreshes = jobCreateResponse.remainingRefreshes - additionalProperties(jobCreateResponse.additionalProperties) + allowedRefreshes = jobCreateResponse.allowedRefreshes + jobId = jobCreateResponse.jobId + jobUrl = jobCreateResponse.jobUrl + remainingRefreshes = jobCreateResponse.remainingRefreshes + additionalProperties = jobCreateResponse.additionalProperties.toMutableMap() + } + + /** The number of allowed refreshes per hour (per hour, fixed window) */ + fun allowedRefreshes(allowedRefreshes: Long) = + allowedRefreshes(JsonField.of(allowedRefreshes)) + + /** The number of allowed refreshes per hour (per hour, fixed window) */ + fun allowedRefreshes(allowedRefreshes: JsonField) = apply { + this.allowedRefreshes = allowedRefreshes } /** The id of the job that has been created. */ fun jobId(jobId: String) = jobId(JsonField.of(jobId)) /** The id of the job that has been created. */ - @JsonProperty("job_id") - @ExcludeMissing fun jobId(jobId: JsonField) = apply { this.jobId = jobId } /** The url that can be used to retrieve the job status */ fun jobUrl(jobUrl: String) = jobUrl(JsonField.of(jobUrl)) /** The url that can be used to retrieve the job status */ - @JsonProperty("job_url") - @ExcludeMissing fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl } - /** The number of allowed refreshes per hour (per hour, fixed window) */ - fun allowedRefreshes(allowedRefreshes: Long) = - allowedRefreshes(JsonField.of(allowedRefreshes)) - - /** The number of allowed refreshes per hour (per hour, fixed window) */ - @JsonProperty("allowed_refreshes") - @ExcludeMissing - fun allowedRefreshes(allowedRefreshes: JsonField) = apply { - this.allowedRefreshes = allowedRefreshes - } - /** The number of remaining refreshes available (per hour, fixed window) */ fun remainingRefreshes(remainingRefreshes: Long) = remainingRefreshes(JsonField.of(remainingRefreshes)) /** The number of remaining refreshes available (per hour, fixed window) */ - @JsonProperty("remaining_refreshes") - @ExcludeMissing fun remainingRefreshes(remainingRefreshes: JsonField) = apply { this.remainingRefreshes = remainingRefreshes } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): JobCreateResponse = JobCreateResponse( + allowedRefreshes, jobId, jobUrl, - allowedRefreshes, remainingRefreshes, additionalProperties.toImmutable(), ) @@ -158,15 +162,15 @@ private constructor( return true } - return /* spotless:off */ other is JobCreateResponse && jobId == other.jobId && jobUrl == other.jobUrl && allowedRefreshes == other.allowedRefreshes && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is JobCreateResponse && allowedRefreshes == other.allowedRefreshes && jobId == other.jobId && jobUrl == other.jobUrl && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(jobId, jobUrl, allowedRefreshes, remainingRefreshes, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(allowedRefreshes, jobId, jobUrl, remainingRefreshes, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "JobCreateResponse{jobId=$jobId, jobUrl=$jobUrl, allowedRefreshes=$allowedRefreshes, remainingRefreshes=$remainingRefreshes, additionalProperties=$additionalProperties}" + "JobCreateResponse{allowedRefreshes=$allowedRefreshes, jobId=$jobId, jobUrl=$jobUrl, remainingRefreshes=$remainingRefreshes, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt index 893f1856..1ec9a5cb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Location.kt @@ -4,33 +4,44 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Location.Builder::class) @NoAutoDetect class Location +@JsonCreator private constructor( - private val line1: JsonField, - private val line2: JsonField, - private val city: JsonField, - private val state: JsonField, - private val postalCode: JsonField, - private val country: JsonField, - private val name: JsonField, - private val sourceId: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") @ExcludeMissing private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") @ExcludeMissing private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") @ExcludeMissing private val line2: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("source_id") + @ExcludeMissing + private val sourceId: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing private val state: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** City, district, suburb, town, or village. */ + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + /** The 2-letter ISO 3166 country code. */ + fun country(): Optional = Optional.ofNullable(country.getNullable("country")) /** Street address or PO box. */ fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) @@ -38,21 +49,21 @@ private constructor( /** Apartment, suite, unit, or building. */ fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - /** City, district, suburb, town, or village. */ - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) - - /** The state code. */ - fun state(): Optional = Optional.ofNullable(state.getNullable("state")) + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** The postal code or zip code. */ fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code")) - /** The 2-letter ISO 3166 country code. */ - fun country(): Optional = Optional.ofNullable(country.getNullable("country")) + fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** The state code. */ + fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id")) + /** City, district, suburb, town, or village. */ + @JsonProperty("city") @ExcludeMissing fun _city() = city + + /** The 2-letter ISO 3166 country code. */ + @JsonProperty("country") @ExcludeMissing fun _country() = country /** Street address or PO box. */ @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @@ -60,36 +71,32 @@ private constructor( /** Apartment, suite, unit, or building. */ @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - /** City, district, suburb, town, or village. */ - @JsonProperty("city") @ExcludeMissing fun _city() = city - - /** The state code. */ - @JsonProperty("state") @ExcludeMissing fun _state() = state + @JsonProperty("name") @ExcludeMissing fun _name() = name /** The postal code or zip code. */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - /** The 2-letter ISO 3166 country code. */ - @JsonProperty("country") @ExcludeMissing fun _country() = country - - @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("source_id") @ExcludeMissing fun _sourceId() = sourceId + /** The state code. */ + @JsonProperty("state") @ExcludeMissing fun _state() = state + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Location = apply { if (!validated) { - line1() - line2() city() - state() - postalCode() country() + line1() + line2() name() + postalCode() sourceId() + state() validated = true } } @@ -103,113 +110,102 @@ private constructor( class Builder { - private var line1: JsonField = JsonMissing.of() - private var line2: JsonField = JsonMissing.of() private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() - private var postalCode: JsonField = JsonMissing.of() private var country: JsonField = JsonMissing.of() + private var line1: JsonField = JsonMissing.of() + private var line2: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() + private var postalCode: JsonField = JsonMissing.of() private var sourceId: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(location: Location) = apply { - this.line1 = location.line1 - this.line2 = location.line2 - this.city = location.city - this.state = location.state - this.postalCode = location.postalCode - this.country = location.country - this.name = location.name - this.sourceId = location.sourceId - additionalProperties(location.additionalProperties) + city = location.city + country = location.country + line1 = location.line1 + line2 = location.line2 + name = location.name + postalCode = location.postalCode + sourceId = location.sourceId + state = location.state + additionalProperties = location.additionalProperties.toMutableMap() } + /** City, district, suburb, town, or village. */ + fun city(city: String) = city(JsonField.of(city)) + + /** City, district, suburb, town, or village. */ + fun city(city: JsonField) = apply { this.city = city } + + /** The 2-letter ISO 3166 country code. */ + fun country(country: String) = country(JsonField.of(country)) + + /** The 2-letter ISO 3166 country code. */ + fun country(country: JsonField) = apply { this.country = country } + /** Street address or PO box. */ fun line1(line1: String) = line1(JsonField.of(line1)) /** Street address or PO box. */ - @JsonProperty("line1") - @ExcludeMissing fun line1(line1: JsonField) = apply { this.line1 = line1 } /** Apartment, suite, unit, or building. */ fun line2(line2: String) = line2(JsonField.of(line2)) /** Apartment, suite, unit, or building. */ - @JsonProperty("line2") - @ExcludeMissing fun line2(line2: JsonField) = apply { this.line2 = line2 } - /** City, district, suburb, town, or village. */ - fun city(city: String) = city(JsonField.of(city)) - - /** City, district, suburb, town, or village. */ - @JsonProperty("city") - @ExcludeMissing - fun city(city: JsonField) = apply { this.city = city } - - /** The state code. */ - fun state(state: String) = state(JsonField.of(state)) + fun name(name: String) = name(JsonField.of(name)) - /** The state code. */ - @JsonProperty("state") - @ExcludeMissing - fun state(state: JsonField) = apply { this.state = state } + fun name(name: JsonField) = apply { this.name = name } /** The postal code or zip code. */ fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) /** The postal code or zip code. */ - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - /** The 2-letter ISO 3166 country code. */ - fun country(country: String) = country(JsonField.of(country)) - - /** The 2-letter ISO 3166 country code. */ - @JsonProperty("country") - @ExcludeMissing - fun country(country: JsonField) = apply { this.country = country } - - fun name(name: String) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - @JsonProperty("source_id") - @ExcludeMissing fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } + /** The state code. */ + fun state(state: String) = state(JsonField.of(state)) + + /** The state code. */ + fun state(state: JsonField) = apply { this.state = state } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Location = Location( - line1, - line2, city, - state, - postalCode, country, + line1, + line2, name, + postalCode, sourceId, + state, additionalProperties.toImmutable(), ) } @@ -219,15 +215,15 @@ private constructor( return true } - return /* spotless:off */ other is Location && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && name == other.name && sourceId == other.sourceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Location && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && name == other.name && postalCode == other.postalCode && sourceId == other.sourceId && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, name, sourceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, name, postalCode, sourceId, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Location{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, name=$name, sourceId=$sourceId, additionalProperties=$additionalProperties}" + "Location{city=$city, country=$country, line1=$line1, line2=$line2, name=$name, postalCode=$postalCode, sourceId=$sourceId, state=$state, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index 9ff5e5f5..e5969d97 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -6,53 +6,57 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = ManualAsyncJob.Builder::class) @NoAutoDetect class ManualAsyncJob +@JsonCreator private constructor( - private val jobId: JsonField, - private val status: JsonField, - private val body: JsonField>, - private val additionalProperties: Map, + @JsonProperty("body") + @ExcludeMissing + private val body: JsonField> = JsonMissing.of(), + @JsonProperty("job_id") @ExcludeMissing private val jobId: JsonField = JsonMissing.of(), + @JsonProperty("status") + @ExcludeMissing + private val status: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** Specific information about the job, such as individual statuses for batch jobs. */ + fun body(): Optional> = Optional.ofNullable(body.getNullable("body")) fun jobId(): String = jobId.getRequired("job_id") fun status(): Status = status.getRequired("status") /** Specific information about the job, such as individual statuses for batch jobs. */ - fun body(): Optional> = Optional.ofNullable(body.getNullable("body")) + @JsonProperty("body") @ExcludeMissing fun _body() = body @JsonProperty("job_id") @ExcludeMissing fun _jobId() = jobId @JsonProperty("status") @ExcludeMissing fun _status() = status - /** Specific information about the job, such as individual statuses for batch jobs. */ - @JsonProperty("body") @ExcludeMissing fun _body() = body - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): ManualAsyncJob = apply { if (!validated) { + body() jobId() status() - body() validated = true } } @@ -66,58 +70,57 @@ private constructor( class Builder { + private var body: JsonField> = JsonMissing.of() private var jobId: JsonField = JsonMissing.of() private var status: JsonField = JsonMissing.of() - private var body: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(manualAsyncJob: ManualAsyncJob) = apply { - this.jobId = manualAsyncJob.jobId - this.status = manualAsyncJob.status - this.body = manualAsyncJob.body - additionalProperties(manualAsyncJob.additionalProperties) + body = manualAsyncJob.body + jobId = manualAsyncJob.jobId + status = manualAsyncJob.status + additionalProperties = manualAsyncJob.additionalProperties.toMutableMap() } + /** Specific information about the job, such as individual statuses for batch jobs. */ + fun body(body: List) = body(JsonField.of(body)) + + /** Specific information about the job, such as individual statuses for batch jobs. */ + fun body(body: JsonField>) = apply { this.body = body } + fun jobId(jobId: String) = jobId(JsonField.of(jobId)) - @JsonProperty("job_id") - @ExcludeMissing fun jobId(jobId: JsonField) = apply { this.jobId = jobId } fun status(status: Status) = status(JsonField.of(status)) - @JsonProperty("status") - @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } - /** Specific information about the job, such as individual statuses for batch jobs. */ - fun body(body: List) = body(JsonField.of(body)) - - /** Specific information about the job, such as individual statuses for batch jobs. */ - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField>) = apply { this.body = body } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): ManualAsyncJob = ManualAsyncJob( + body.map { it.toImmutable() }, jobId, status, - body.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -196,15 +199,15 @@ private constructor( return true } - return /* spotless:off */ other is ManualAsyncJob && jobId == other.jobId && status == other.status && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ManualAsyncJob && body == other.body && jobId == other.jobId && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(jobId, status, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, jobId, status, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ManualAsyncJob{jobId=$jobId, status=$status, body=$body, additionalProperties=$additionalProperties}" + "ManualAsyncJob{body=$body, jobId=$jobId, status=$status, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index 056c6aa6..3305db6c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -4,28 +4,29 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Money.Builder::class) @NoAutoDetect class Money +@JsonCreator private constructor( - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** Amount for money object (in cents) */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) @@ -40,6 +41,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Money = apply { if (!validated) { amount() @@ -63,39 +66,40 @@ private constructor( @JvmSynthetic internal fun from(money: Money) = apply { - this.amount = money.amount - this.currency = money.currency - additionalProperties(money.additionalProperties) + amount = money.amount + currency = money.currency + additionalProperties = money.additionalProperties.toMutableMap() } /** Amount for money object (in cents) */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** Amount for money object (in cents) */ - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: String) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Money = Money( amount, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index 38670699..2e2ed02d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -4,30 +4,37 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = OperationSupportMatrix.Builder::class) @NoAutoDetect class OperationSupportMatrix +@JsonCreator private constructor( - private val create: JsonField, - private val update: JsonField, - private val delete: JsonField, - private val read: JsonField, - private val additionalProperties: Map, + @JsonProperty("create") + @ExcludeMissing + private val create: JsonField = JsonMissing.of(), + @JsonProperty("delete") + @ExcludeMissing + private val delete: JsonField = JsonMissing.of(), + @JsonProperty("read") + @ExcludeMissing + private val read: JsonField = JsonMissing.of(), + @JsonProperty("update") + @ExcludeMissing + private val update: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** * - `supported`: This operation is supported by both the provider and Finch * - `not_supported_by_finch`: This operation is not supported by Finch but supported by the @@ -48,7 +55,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ - fun update(): Optional = Optional.ofNullable(update.getNullable("update")) + fun delete(): Optional = Optional.ofNullable(delete.getNullable("delete")) /** * - `supported`: This operation is supported by both the provider and Finch @@ -59,7 +66,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ - fun delete(): Optional = Optional.ofNullable(delete.getNullable("delete")) + fun read(): Optional = Optional.ofNullable(read.getNullable("read")) /** * - `supported`: This operation is supported by both the provider and Finch @@ -70,7 +77,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ - fun read(): Optional = Optional.ofNullable(read.getNullable("read")) + fun update(): Optional = Optional.ofNullable(update.getNullable("update")) /** * - `supported`: This operation is supported by both the provider and Finch @@ -92,7 +99,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ - @JsonProperty("update") @ExcludeMissing fun _update() = update + @JsonProperty("delete") @ExcludeMissing fun _delete() = delete /** * - `supported`: This operation is supported by both the provider and Finch @@ -103,7 +110,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ - @JsonProperty("delete") @ExcludeMissing fun _delete() = delete + @JsonProperty("read") @ExcludeMissing fun _read() = read /** * - `supported`: This operation is supported by both the provider and Finch @@ -114,18 +121,20 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ - @JsonProperty("read") @ExcludeMissing fun _read() = read + @JsonProperty("update") @ExcludeMissing fun _update() = update @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): OperationSupportMatrix = apply { if (!validated) { create() - update() delete() read() + update() validated = true } } @@ -140,18 +149,18 @@ private constructor( class Builder { private var create: JsonField = JsonMissing.of() - private var update: JsonField = JsonMissing.of() private var delete: JsonField = JsonMissing.of() private var read: JsonField = JsonMissing.of() + private var update: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(operationSupportMatrix: OperationSupportMatrix) = apply { - this.create = operationSupportMatrix.create - this.update = operationSupportMatrix.update - this.delete = operationSupportMatrix.delete - this.read = operationSupportMatrix.read - additionalProperties(operationSupportMatrix.additionalProperties) + create = operationSupportMatrix.create + delete = operationSupportMatrix.delete + read = operationSupportMatrix.read + update = operationSupportMatrix.update + additionalProperties = operationSupportMatrix.additionalProperties.toMutableMap() } /** @@ -174,8 +183,6 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - @JsonProperty("create") - @ExcludeMissing fun create(create: JsonField) = apply { this.create = create } /** @@ -187,7 +194,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - fun update(update: OperationSupport) = update(JsonField.of(update)) + fun delete(delete: OperationSupport) = delete(JsonField.of(delete)) /** * - `supported`: This operation is supported by both the provider and Finch @@ -198,9 +205,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - @JsonProperty("update") - @ExcludeMissing - fun update(update: JsonField) = apply { this.update = update } + fun delete(delete: JsonField) = apply { this.delete = delete } /** * - `supported`: This operation is supported by both the provider and Finch @@ -211,7 +216,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - fun delete(delete: OperationSupport) = delete(JsonField.of(delete)) + fun read(read: OperationSupport) = read(JsonField.of(read)) /** * - `supported`: This operation is supported by both the provider and Finch @@ -222,9 +227,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - @JsonProperty("delete") - @ExcludeMissing - fun delete(delete: JsonField) = apply { this.delete = delete } + fun read(read: JsonField) = apply { this.read = read } /** * - `supported`: This operation is supported by both the provider and Finch @@ -235,7 +238,7 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - fun read(read: OperationSupport) = read(JsonField.of(read)) + fun update(update: OperationSupport) = update(JsonField.of(update)) /** * - `supported`: This operation is supported by both the provider and Finch @@ -246,30 +249,33 @@ private constructor( * - `client_access_only`: This behavior is supported by the provider, but only available to * the client and not to Finch */ - @JsonProperty("read") - @ExcludeMissing - fun read(read: JsonField) = apply { this.read = read } + fun update(update: JsonField) = apply { this.update = update } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): OperationSupportMatrix = OperationSupportMatrix( create, - update, delete, read, + update, additionalProperties.toImmutable(), ) } @@ -279,15 +285,15 @@ private constructor( return true } - return /* spotless:off */ other is OperationSupportMatrix && create == other.create && update == other.update && delete == other.delete && read == other.read && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is OperationSupportMatrix && create == other.create && delete == other.delete && read == other.read && update == other.update && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(create, update, delete, read, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(create, delete, read, update, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "OperationSupportMatrix{create=$create, update=$update, delete=$delete, read=$read, additionalProperties=$additionalProperties}" + "OperationSupportMatrix{create=$create, delete=$delete, read=$read, update=$update, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index 37449a7b..fe1f77e2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -4,28 +4,27 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Paging.Builder::class) @NoAutoDetect class Paging +@JsonCreator private constructor( - private val count: JsonField, - private val offset: JsonField, - private val additionalProperties: Map, + @JsonProperty("count") @ExcludeMissing private val count: JsonField = JsonMissing.of(), + @JsonProperty("offset") @ExcludeMissing private val offset: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The total number of elements for the entire query (not just the given page) */ fun count(): Optional = Optional.ofNullable(count.getNullable("count")) @@ -42,6 +41,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Paging = apply { if (!validated) { count() @@ -65,41 +66,42 @@ private constructor( @JvmSynthetic internal fun from(paging: Paging) = apply { - this.count = paging.count - this.offset = paging.offset - additionalProperties(paging.additionalProperties) + count = paging.count + offset = paging.offset + additionalProperties = paging.additionalProperties.toMutableMap() } /** The total number of elements for the entire query (not just the given page) */ fun count(count: Long) = count(JsonField.of(count)) /** The total number of elements for the entire query (not just the given page) */ - @JsonProperty("count") - @ExcludeMissing fun count(count: JsonField) = apply { this.count = count } /** The current start index of the returned list of elements */ fun offset(offset: Long) = offset(JsonField.of(offset)) /** The current start index of the returned list of elements */ - @JsonProperty("offset") - @ExcludeMissing fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Paging = Paging( count, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index f58c2517..8539c47f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -6,30 +6,30 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = PayGroupListResponse.Builder::class) @NoAutoDetect class PayGroupListResponse +@JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val payFrequencies: JsonField>, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** Finch id (uuidv4) for the pay group */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -53,6 +53,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayGroupListResponse = apply { if (!validated) { id() @@ -78,24 +80,22 @@ private constructor( @JvmSynthetic internal fun from(payGroupListResponse: PayGroupListResponse) = apply { - this.id = payGroupListResponse.id - this.name = payGroupListResponse.name - this.payFrequencies = payGroupListResponse.payFrequencies - additionalProperties(payGroupListResponse.additionalProperties) + id = payGroupListResponse.id + name = payGroupListResponse.name + payFrequencies = payGroupListResponse.payFrequencies + additionalProperties = payGroupListResponse.additionalProperties.toMutableMap() } /** Finch id (uuidv4) for the pay group */ fun id(id: String) = id(JsonField.of(id)) /** Finch id (uuidv4) for the pay group */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } /** Name of the pay group */ fun name(name: String) = name(JsonField.of(name)) /** Name of the pay group */ - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } /** List of pay frequencies associated with this pay group */ @@ -103,26 +103,29 @@ private constructor( payFrequencies(JsonField.of(payFrequencies)) /** List of pay frequencies associated with this pay group */ - @JsonProperty("pay_frequencies") - @ExcludeMissing fun payFrequencies(payFrequencies: JsonField>) = apply { this.payFrequencies = payFrequencies } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayGroupListResponse = PayGroupListResponse( id, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index c96f9aee..583c9ac3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -6,62 +6,66 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects -@JsonDeserialize(builder = PayGroupRetrieveResponse.Builder::class) @NoAutoDetect class PayGroupRetrieveResponse +@JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val payFrequencies: JsonField>, - private val individualIds: JsonField>, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField> = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** Finch id (uuidv4) for the pay group */ fun id(): String = id.getRequired("id") + fun individualIds(): List = individualIds.getRequired("individual_ids") + /** Name of the pay group */ fun name(): String = name.getRequired("name") /** List of pay frequencies associated with this pay group */ fun payFrequencies(): List = payFrequencies.getRequired("pay_frequencies") - fun individualIds(): List = individualIds.getRequired("individual_ids") - /** Finch id (uuidv4) for the pay group */ @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds + /** Name of the pay group */ @JsonProperty("name") @ExcludeMissing fun _name() = name /** List of pay frequencies associated with this pay group */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies - @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayGroupRetrieveResponse = apply { if (!validated) { id() + individualIds() name() payFrequencies() - individualIds() validated = true } } @@ -76,32 +80,36 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var individualIds: JsonField> = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var payFrequencies: JsonField> = JsonMissing.of() - private var individualIds: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payGroupRetrieveResponse: PayGroupRetrieveResponse) = apply { - this.id = payGroupRetrieveResponse.id - this.name = payGroupRetrieveResponse.name - this.payFrequencies = payGroupRetrieveResponse.payFrequencies - this.individualIds = payGroupRetrieveResponse.individualIds - additionalProperties(payGroupRetrieveResponse.additionalProperties) + id = payGroupRetrieveResponse.id + individualIds = payGroupRetrieveResponse.individualIds + name = payGroupRetrieveResponse.name + payFrequencies = payGroupRetrieveResponse.payFrequencies + additionalProperties = payGroupRetrieveResponse.additionalProperties.toMutableMap() } /** Finch id (uuidv4) for the pay group */ fun id(id: String) = id(JsonField.of(id)) /** Finch id (uuidv4) for the pay group */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } + + fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) + + fun individualIds(individualIds: JsonField>) = apply { + this.individualIds = individualIds + } /** Name of the pay group */ fun name(name: String) = name(JsonField.of(name)) /** Name of the pay group */ - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } /** List of pay frequencies associated with this pay group */ @@ -109,40 +117,35 @@ private constructor( payFrequencies(JsonField.of(payFrequencies)) /** List of pay frequencies associated with this pay group */ - @JsonProperty("pay_frequencies") - @ExcludeMissing fun payFrequencies(payFrequencies: JsonField>) = apply { this.payFrequencies = payFrequencies } - fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) - - @JsonProperty("individual_ids") - @ExcludeMissing - fun individualIds(individualIds: JsonField>) = apply { - this.individualIds = individualIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayGroupRetrieveResponse = PayGroupRetrieveResponse( id, + individualIds.map { it.toImmutable() }, name, payFrequencies.map { it.toImmutable() }, - individualIds.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } @@ -251,15 +254,15 @@ private constructor( return true } - return /* spotless:off */ other is PayGroupRetrieveResponse && id == other.id && name == other.name && payFrequencies == other.payFrequencies && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayGroupRetrieveResponse && id == other.id && individualIds == other.individualIds && name == other.name && payFrequencies == other.payFrequencies && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, payFrequencies, individualIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, individualIds, name, payFrequencies, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayGroupRetrieveResponse{id=$id, name=$name, payFrequencies=$payFrequencies, individualIds=$individualIds, additionalProperties=$additionalProperties}" + "PayGroupRetrieveResponse{id=$id, individualIds=$individualIds, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index 38a7fe1a..a39df463 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -6,115 +6,133 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = PayStatement.Builder::class) @NoAutoDetect class PayStatement +@JsonCreator private constructor( - private val individualId: JsonField, - private val type: JsonField, - private val paymentMethod: JsonField, - private val totalHours: JsonField, - private val grossPay: JsonField, - private val netPay: JsonField, - private val earnings: JsonField>, - private val taxes: JsonField>, - private val employeeDeductions: JsonField>, - private val employerContributions: JsonField>, - private val additionalProperties: Map, + @JsonProperty("earnings") + @ExcludeMissing + private val earnings: JsonField> = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + private val employeeDeductions: JsonField> = JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + private val employerContributions: JsonField> = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + private val grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + private val netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + private val paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") + @ExcludeMissing + private val taxes: JsonField> = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + private val totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The array of earnings objects associated with this pay statement */ + fun earnings(): Optional> = Optional.ofNullable(earnings.getNullable("earnings")) + + /** The array of deductions objects associated with this pay statement. */ + fun employeeDeductions(): Optional> = + Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + + fun employerContributions(): Optional> = + Optional.ofNullable(employerContributions.getNullable("employer_contributions")) + + fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) /** A stable Finch `id` (UUID v4) for an individual in the company */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) - /** The type of the payment associated with the pay statement. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) /** The payment method. */ fun paymentMethod(): Optional = Optional.ofNullable(paymentMethod.getNullable("payment_method")) + /** The array of taxes objects associated with this pay statement. */ + fun taxes(): Optional> = Optional.ofNullable(taxes.getNullable("taxes")) + /** The number of hours worked for this pay period */ fun totalHours(): Optional = Optional.ofNullable(totalHours.getNullable("total_hours")) - fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) - - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + /** The type of the payment associated with the pay statement. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** The array of earnings objects associated with this pay statement */ - fun earnings(): Optional> = Optional.ofNullable(earnings.getNullable("earnings")) - - /** The array of taxes objects associated with this pay statement. */ - fun taxes(): Optional> = Optional.ofNullable(taxes.getNullable("taxes")) + @JsonProperty("earnings") @ExcludeMissing fun _earnings() = earnings /** The array of deductions objects associated with this pay statement. */ - fun employeeDeductions(): Optional> = - Optional.ofNullable(employeeDeductions.getNullable("employee_deductions")) + @JsonProperty("employee_deductions") + @ExcludeMissing + fun _employeeDeductions() = employeeDeductions - fun employerContributions(): Optional> = - Optional.ofNullable(employerContributions.getNullable("employer_contributions")) + @JsonProperty("employer_contributions") + @ExcludeMissing + fun _employerContributions() = employerContributions + + @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay /** A stable Finch `id` (UUID v4) for an individual in the company */ @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId - /** The type of the payment associated with the pay statement. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay /** The payment method. */ @JsonProperty("payment_method") @ExcludeMissing fun _paymentMethod() = paymentMethod - /** The number of hours worked for this pay period */ - @JsonProperty("total_hours") @ExcludeMissing fun _totalHours() = totalHours - - @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay - - @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay - - /** The array of earnings objects associated with this pay statement */ - @JsonProperty("earnings") @ExcludeMissing fun _earnings() = earnings - /** The array of taxes objects associated with this pay statement. */ @JsonProperty("taxes") @ExcludeMissing fun _taxes() = taxes - /** The array of deductions objects associated with this pay statement. */ - @JsonProperty("employee_deductions") - @ExcludeMissing - fun _employeeDeductions() = employeeDeductions + /** The number of hours worked for this pay period */ + @JsonProperty("total_hours") @ExcludeMissing fun _totalHours() = totalHours - @JsonProperty("employer_contributions") - @ExcludeMissing - fun _employerContributions() = employerContributions + /** The type of the payment associated with the pay statement. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayStatement = apply { if (!validated) { - individualId() - type() - paymentMethod() - totalHours() - grossPay().map { it.validate() } - netPay().map { it.validate() } earnings().map { it.forEach { it?.validate() } } - taxes().map { it.forEach { it?.validate() } } employeeDeductions().map { it.forEach { it?.validate() } } employerContributions().map { it.forEach { it?.validate() } } + grossPay().map { it.validate() } + individualId() + netPay().map { it.validate() } + paymentMethod() + taxes().map { it.forEach { it?.validate() } } + totalHours() + type() validated = true } } @@ -128,168 +146,154 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var paymentMethod: JsonField = JsonMissing.of() - private var totalHours: JsonField = JsonMissing.of() - private var grossPay: JsonField = JsonMissing.of() - private var netPay: JsonField = JsonMissing.of() private var earnings: JsonField> = JsonMissing.of() - private var taxes: JsonField> = JsonMissing.of() private var employeeDeductions: JsonField> = JsonMissing.of() private var employerContributions: JsonField> = JsonMissing.of() + private var grossPay: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() + private var netPay: JsonField = JsonMissing.of() + private var paymentMethod: JsonField = JsonMissing.of() + private var taxes: JsonField> = JsonMissing.of() + private var totalHours: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() 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) + earnings = payStatement.earnings + employeeDeductions = payStatement.employeeDeductions + employerContributions = payStatement.employerContributions + grossPay = payStatement.grossPay + individualId = payStatement.individualId + netPay = payStatement.netPay + paymentMethod = payStatement.paymentMethod + taxes = payStatement.taxes + totalHours = payStatement.totalHours + type = payStatement.type + additionalProperties = payStatement.additionalProperties.toMutableMap() } + /** The array of earnings objects associated with this pay statement */ + fun earnings(earnings: List) = earnings(JsonField.of(earnings)) + + /** The array of earnings objects associated with this pay statement */ + fun earnings(earnings: JsonField>) = apply { this.earnings = earnings } + + /** The array of deductions objects associated with this pay statement. */ + fun employeeDeductions(employeeDeductions: List) = + employeeDeductions(JsonField.of(employeeDeductions)) + + /** The array of deductions objects associated with this pay statement. */ + fun employeeDeductions(employeeDeductions: JsonField>) = apply { + this.employeeDeductions = employeeDeductions + } + + fun employerContributions(employerContributions: List) = + employerContributions(JsonField.of(employerContributions)) + + fun employerContributions(employerContributions: JsonField>) = + apply { + this.employerContributions = employerContributions + } + + fun grossPay(grossPay: Money) = grossPay(JsonField.of(grossPay)) + + fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } + /** A stable Finch `id` (UUID v4) for an individual in the company */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** A stable Finch `id` (UUID v4) for an individual in the company */ - @JsonProperty("individual_id") - @ExcludeMissing fun individualId(individualId: JsonField) = apply { this.individualId = individualId } - /** The type of the payment associated with the pay statement. */ - fun type(type: Type) = type(JsonField.of(type)) + fun netPay(netPay: Money) = netPay(JsonField.of(netPay)) - /** The type of the payment associated with the pay statement. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + fun netPay(netPay: JsonField) = apply { this.netPay = netPay } /** The payment method. */ fun paymentMethod(paymentMethod: PaymentMethod) = paymentMethod(JsonField.of(paymentMethod)) /** The payment method. */ - @JsonProperty("payment_method") - @ExcludeMissing fun paymentMethod(paymentMethod: JsonField) = apply { this.paymentMethod = paymentMethod } - /** The number of hours worked for this pay period */ - fun totalHours(totalHours: Double) = totalHours(JsonField.of(totalHours)) - - /** The number of hours worked for this pay period */ - @JsonProperty("total_hours") - @ExcludeMissing - fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } - - fun grossPay(grossPay: Money) = grossPay(JsonField.of(grossPay)) - - @JsonProperty("gross_pay") - @ExcludeMissing - fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } - - fun netPay(netPay: Money) = netPay(JsonField.of(netPay)) - - @JsonProperty("net_pay") - @ExcludeMissing - fun netPay(netPay: JsonField) = apply { this.netPay = netPay } - - /** The array of earnings objects associated with this pay statement */ - fun earnings(earnings: List) = earnings(JsonField.of(earnings)) - - /** The array of earnings objects associated with this pay statement */ - @JsonProperty("earnings") - @ExcludeMissing - fun earnings(earnings: JsonField>) = apply { this.earnings = earnings } - /** The array of taxes objects associated with this pay statement. */ fun taxes(taxes: List) = taxes(JsonField.of(taxes)) /** The array of taxes objects associated with this pay statement. */ - @JsonProperty("taxes") - @ExcludeMissing fun taxes(taxes: JsonField>) = apply { this.taxes = taxes } - /** The array of deductions objects associated with this pay statement. */ - fun employeeDeductions(employeeDeductions: List) = - employeeDeductions(JsonField.of(employeeDeductions)) + /** The number of hours worked for this pay period */ + fun totalHours(totalHours: Double) = totalHours(JsonField.of(totalHours)) - /** The array of deductions objects associated with this pay statement. */ - @JsonProperty("employee_deductions") - @ExcludeMissing - fun employeeDeductions(employeeDeductions: JsonField>) = apply { - this.employeeDeductions = employeeDeductions - } + /** The number of hours worked for this pay period */ + fun totalHours(totalHours: JsonField) = apply { this.totalHours = totalHours } - fun employerContributions(employerContributions: List) = - employerContributions(JsonField.of(employerContributions)) + /** The type of the payment associated with the pay statement. */ + fun type(type: Type) = type(JsonField.of(type)) - @JsonProperty("employer_contributions") - @ExcludeMissing - fun employerContributions(employerContributions: JsonField>) = - apply { - this.employerContributions = employerContributions - } + /** The type of the payment associated with the pay statement. */ + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatement = PayStatement( - individualId, - type, - paymentMethod, - totalHours, - grossPay, - netPay, earnings.map { it.toImmutable() }, - taxes.map { it.toImmutable() }, employeeDeductions.map { it.toImmutable() }, employerContributions.map { it.toImmutable() }, + grossPay, + individualId, + netPay, + paymentMethod, + taxes.map { it.toImmutable() }, + totalHours, + type, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Earning.Builder::class) @NoAutoDetect class Earning + @JsonCreator private constructor( - private val type: JsonField, - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val hours: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("hours") + @ExcludeMissing + private val hours: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The type of earning. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - - /** The exact name of the deduction from the pay statement. */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The earnings amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) @@ -302,11 +306,11 @@ private constructor( */ fun hours(): Optional = Optional.ofNullable(hours.getNullable("hours")) - /** The type of earning. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type - /** The exact name of the deduction from the pay statement. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + + /** The type of earning. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** The earnings amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -320,17 +324,25 @@ private constructor( */ @JsonProperty("hours") @ExcludeMissing fun _hours() = hours + /** The exact name of the deduction from the pay statement. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The type of earning. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Earning = apply { if (!validated) { - type() - name() amount() currency() hours() + name() + type() validated = true } } @@ -344,53 +356,33 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var hours: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() 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) + amount = earning.amount + currency = earning.currency + hours = earning.hours + name = earning.name + type = earning.type + additionalProperties = earning.additionalProperties.toMutableMap() } - /** The type of earning. */ - fun type(type: Type) = type(JsonField.of(type)) - - /** The type of earning. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - /** The exact name of the deduction from the pay statement. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The exact name of the deduction from the pay statement. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The earnings amount in cents. */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** The earnings amount in cents. */ - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } /** The earnings currency code. */ fun currency(currency: String) = currency(JsonField.of(currency)) /** The earnings currency code. */ - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } /** @@ -403,31 +395,46 @@ private constructor( * The number of hours associated with this earning. (For salaried employees, this could * be hours per pay period, `0` or `null`, depending on the provider). */ - @JsonProperty("hours") - @ExcludeMissing fun hours(hours: JsonField) = apply { this.hours = hours } + /** The exact name of the deduction from the pay statement. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The exact name of the deduction from the pay statement. */ + fun name(name: JsonField) = apply { this.name = name } + + /** The type of earning. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The type of earning. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Earning = Earning( - type, - name, amount, currency, hours, + name, + type, additionalProperties.toImmutable(), ) } @@ -560,57 +567,66 @@ private constructor( return true } - return /* spotless:off */ other is Earning && type == other.type && name == other.name && amount == other.amount && currency == other.currency && hours == other.hours && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Earning && amount == other.amount && currency == other.currency && hours == other.hours && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, amount, currency, hours, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, hours, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Earning{type=$type, name=$name, amount=$amount, currency=$currency, hours=$hours, additionalProperties=$additionalProperties}" + "Earning{amount=$amount, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployeeDeduction.Builder::class) @NoAutoDetect class EmployeeDeduction + @JsonCreator private constructor( - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val preTax: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") + @ExcludeMissing + private val preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The deduction name from the pay statement. */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The deduction amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) /** The deduction currency. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** The deduction name from the pay statement. */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** Boolean indicating if the deduction is pre-tax. */ fun preTax(): Optional = Optional.ofNullable(preTax.getNullable("pre_tax")) /** Type of benefit. */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The deduction name from the pay statement. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - /** The deduction amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The deduction currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** The deduction name from the pay statement. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + /** Boolean indicating if the deduction is pre-tax. */ @JsonProperty("pre_tax") @ExcludeMissing fun _preTax() = preTax @@ -621,11 +637,13 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmployeeDeduction = apply { if (!validated) { - name() amount() currency() + name() preTax() type() validated = true @@ -641,82 +659,77 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var preTax: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() 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) + amount = employeeDeduction.amount + currency = employeeDeduction.currency + name = employeeDeduction.name + preTax = employeeDeduction.preTax + type = employeeDeduction.type + additionalProperties = employeeDeduction.additionalProperties.toMutableMap() } - /** The deduction name from the pay statement. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The deduction name from the pay statement. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The deduction amount in cents. */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** The deduction amount in cents. */ - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } /** The deduction currency. */ fun currency(currency: String) = currency(JsonField.of(currency)) /** The deduction currency. */ - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + /** The deduction name from the pay statement. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The deduction name from the pay statement. */ + fun name(name: JsonField) = apply { this.name = name } + /** Boolean indicating if the deduction is pre-tax. */ fun preTax(preTax: Boolean) = preTax(JsonField.of(preTax)) /** Boolean indicating if the deduction is pre-tax. */ - @JsonProperty("pre_tax") - @ExcludeMissing fun preTax(preTax: JsonField) = apply { this.preTax = preTax } /** Type of benefit. */ fun type(type: BenefitType) = type(JsonField.of(type)) /** Type of benefit. */ - @JsonProperty("type") - @ExcludeMissing fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployeeDeduction = EmployeeDeduction( - name, amount, currency, + name, preTax, type, additionalProperties.toImmutable(), @@ -728,53 +741,60 @@ private constructor( return true } - return /* spotless:off */ other is EmployeeDeduction && name == other.name && amount == other.amount && currency == other.currency && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployeeDeduction && amount == other.amount && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, currency, preTax, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, preTax, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployeeDeduction{name=$name, amount=$amount, currency=$currency, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" + "EmployeeDeduction{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployerContribution.Builder::class) @NoAutoDetect class EmployerContribution + @JsonCreator private constructor( - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The contribution name from the pay statement. */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** The contribution amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) /** The contribution currency. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) + /** The contribution name from the pay statement. */ + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) + /** Type of benefit. */ fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** The contribution name from the pay statement. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name - /** The contribution amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount /** The contribution currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** The contribution name from the pay statement. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + /** Type of benefit. */ @JsonProperty("type") @ExcludeMissing fun _type() = type @@ -782,11 +802,13 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmployerContribution = apply { if (!validated) { - name() amount() currency() + name() type() validated = true } @@ -801,72 +823,69 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() 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) + amount = employerContribution.amount + currency = employerContribution.currency + name = employerContribution.name + type = employerContribution.type + additionalProperties = employerContribution.additionalProperties.toMutableMap() } - /** The contribution name from the pay statement. */ - fun name(name: String) = name(JsonField.of(name)) - - /** The contribution name from the pay statement. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** The contribution amount in cents. */ fun amount(amount: Long) = amount(JsonField.of(amount)) /** The contribution amount in cents. */ - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } /** The contribution currency. */ fun currency(currency: String) = currency(JsonField.of(currency)) /** The contribution currency. */ - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + /** The contribution name from the pay statement. */ + fun name(name: String) = name(JsonField.of(name)) + + /** The contribution name from the pay statement. */ + fun name(name: JsonField) = apply { this.name = name } + /** Type of benefit. */ fun type(type: BenefitType) = type(JsonField.of(type)) /** Type of benefit. */ - @JsonProperty("type") - @ExcludeMissing fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployerContribution = EmployerContribution( - name, amount, currency, + name, type, additionalProperties.toImmutable(), ) @@ -877,17 +896,17 @@ private constructor( return true } - return /* spotless:off */ other is EmployerContribution && name == other.name && amount == other.amount && currency == other.currency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployerContribution && amount == other.amount && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, currency, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployerContribution{name=$name, amount=$amount, currency=$currency, type=$type, additionalProperties=$additionalProperties}" + "EmployerContribution{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" } class PaymentMethod @@ -947,43 +966,41 @@ private constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Tax.Builder::class) @NoAutoDetect class Tax + @JsonCreator private constructor( - private val type: JsonField, - private val name: JsonField, - private val employer: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + private val employer: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The type of taxes. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - - /** The exact name of tax from the pay statement. */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - - /** `true` if the amount is paid by the employers. */ - fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) - /** The tax amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) /** The currency code. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - /** The type of taxes. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + /** `true` if the amount is paid by the employers. */ + fun employer(): Optional = Optional.ofNullable(employer.getNullable("employer")) /** The exact name of tax from the pay statement. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** `true` if the amount is paid by the employers. */ - @JsonProperty("employer") @ExcludeMissing fun _employer() = employer + /** The type of taxes. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** The tax amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @@ -991,17 +1008,28 @@ private constructor( /** The currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + /** `true` if the amount is paid by the employers. */ + @JsonProperty("employer") @ExcludeMissing fun _employer() = employer + + /** The exact name of tax from the pay statement. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + + /** The type of taxes. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Tax = apply { if (!validated) { - type() - name() - employer() amount() currency() + employer() + name() + type() validated = true } } @@ -1015,84 +1043,79 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var employer: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var employer: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() 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) + amount = tax.amount + currency = tax.currency + employer = tax.employer + name = tax.name + type = tax.type + additionalProperties = tax.additionalProperties.toMutableMap() } - /** The type of taxes. */ - fun type(type: Type) = type(JsonField.of(type)) + /** The tax amount in cents. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) - /** The type of taxes. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + /** The tax amount in cents. */ + fun amount(amount: JsonField) = apply { this.amount = amount } - /** The exact name of tax from the pay statement. */ - fun name(name: String) = name(JsonField.of(name)) + /** The currency code. */ + fun currency(currency: String) = currency(JsonField.of(currency)) - /** The exact name of tax from the pay statement. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + /** The currency code. */ + fun currency(currency: JsonField) = apply { this.currency = currency } /** `true` if the amount is paid by the employers. */ fun employer(employer: Boolean) = employer(JsonField.of(employer)) /** `true` if the amount is paid by the employers. */ - @JsonProperty("employer") - @ExcludeMissing fun employer(employer: JsonField) = apply { this.employer = employer } - /** The tax amount in cents. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + /** The exact name of tax from the pay statement. */ + fun name(name: String) = name(JsonField.of(name)) - /** The tax amount in cents. */ - @JsonProperty("amount") - @ExcludeMissing - fun amount(amount: JsonField) = apply { this.amount = amount } + /** The exact name of tax from the pay statement. */ + fun name(name: JsonField) = apply { this.name = name } - /** The currency code. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** The type of taxes. */ + fun type(type: Type) = type(JsonField.of(type)) - /** The currency code. */ - @JsonProperty("currency") - @ExcludeMissing - fun currency(currency: JsonField) = apply { this.currency = currency } + /** The type of taxes. */ + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Tax = Tax( - type, - name, - employer, amount, currency, + employer, + name, + type, additionalProperties.toImmutable(), ) } @@ -1171,17 +1194,17 @@ private constructor( return true } - return /* spotless:off */ other is Tax && type == other.type && name == other.name && employer == other.employer && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tax && amount == other.amount && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, employer, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, employer, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tax{type=$type, name=$name, employer=$employer, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "Tax{amount=$amount, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" } class Type @@ -1252,15 +1275,15 @@ private constructor( return true } - return /* spotless:off */ other is PayStatement && individualId == other.individualId && type == other.type && paymentMethod == other.paymentMethod && totalHours == other.totalHours && grossPay == other.grossPay && netPay == other.netPay && earnings == other.earnings && taxes == other.taxes && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayStatement && earnings == other.earnings && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && grossPay == other.grossPay && individualId == other.individualId && netPay == other.netPay && paymentMethod == other.paymentMethod && taxes == other.taxes && totalHours == other.totalHours && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, type, paymentMethod, totalHours, grossPay, netPay, earnings, taxes, employeeDeductions, employerContributions, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(earnings, employeeDeductions, employerContributions, grossPay, individualId, netPay, paymentMethod, taxes, totalHours, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = 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}" + "PayStatement{earnings=$earnings, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, grossPay=$grossPay, individualId=$individualId, netPay=$netPay, paymentMethod=$paymentMethod, taxes=$taxes, totalHours=$totalHours, type=$type, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index 031b2f99..46c7db05 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -6,89 +6,97 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = PayStatementEvent.Builder::class) @NoAutoDetect class PayStatementEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): PayStatementEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,130 +110,130 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payStatementEvent: PayStatementEvent) = apply { - this.connectionId = payStatementEvent.connectionId - this.companyId = payStatementEvent.companyId - this.accountId = payStatementEvent.accountId - this.eventType = payStatementEvent.eventType - this.data = payStatementEvent.data - additionalProperties(payStatementEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = payStatementEvent.accountId + companyId = payStatementEvent.companyId + connectionId = payStatementEvent.connectionId + data = payStatementEvent.data + eventType = payStatementEvent.eventType + additionalProperties = payStatementEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: Data) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatementEvent = PayStatementEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Data.Builder::class) @NoAutoDetect class Data + @JsonCreator private constructor( - private val paymentId: JsonField, - private val individualId: JsonField, - private val additionalProperties: Map, + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") + @ExcludeMissing + private val paymentId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The ID of the payment associated with the pay statement. */ - fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) - /** The ID of the individual associated with the pay statement. */ fun individualId(): Optional = Optional.ofNullable(individualId.getNullable("individual_id")) /** The ID of the payment associated with the pay statement. */ - @JsonProperty("payment_id") @ExcludeMissing fun _paymentId() = paymentId + fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) /** The ID of the individual associated with the pay statement. */ @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + /** The ID of the payment associated with the pay statement. */ + @JsonProperty("payment_id") @ExcludeMissing fun _paymentId() = paymentId + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Data = apply { if (!validated) { - paymentId() individualId() + paymentId() validated = true } } @@ -239,53 +247,54 @@ private constructor( class Builder { - private var paymentId: JsonField = JsonMissing.of() private var individualId: JsonField = JsonMissing.of() + private var paymentId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(data: Data) = apply { - this.paymentId = data.paymentId - this.individualId = data.individualId - additionalProperties(data.additionalProperties) + individualId = data.individualId + paymentId = data.paymentId + additionalProperties = data.additionalProperties.toMutableMap() } - /** The ID of the payment associated with the pay statement. */ - fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) - - /** The ID of the payment associated with the pay statement. */ - @JsonProperty("payment_id") - @ExcludeMissing - fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } - /** The ID of the individual associated with the pay statement. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** The ID of the individual associated with the pay statement. */ - @JsonProperty("individual_id") - @ExcludeMissing fun individualId(individualId: JsonField) = apply { this.individualId = individualId } + /** The ID of the payment associated with the pay statement. */ + fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) + + /** The ID of the payment associated with the pay statement. */ + fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Data = Data( - paymentId, individualId, + paymentId, additionalProperties.toImmutable(), ) } @@ -295,17 +304,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && paymentId == other.paymentId && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && individualId == other.individualId && paymentId == other.paymentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(paymentId, individualId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(individualId, paymentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{paymentId=$paymentId, individualId=$individualId, additionalProperties=$additionalProperties}" + "Data{individualId=$individualId, paymentId=$paymentId, additionalProperties=$additionalProperties}" } class EventType @@ -376,15 +385,15 @@ private constructor( return true } - return /* spotless:off */ other is PayStatementEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayStatementEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayStatementEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "PayStatementEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index c2f2b6fa..5d77697f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -4,50 +4,55 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = PayStatementResponse.Builder::class) @NoAutoDetect class PayStatementResponse +@JsonCreator private constructor( - private val paymentId: JsonField, - private val code: JsonField, - private val body: JsonField, - private val additionalProperties: Map, + @JsonProperty("body") + @ExcludeMissing + private val body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") + @ExcludeMissing + private val paymentId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) + fun body(): Optional = Optional.ofNullable(body.getNullable("body")) fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun paymentId(): Optional = Optional.ofNullable(paymentId.getNullable("payment_id")) - @JsonProperty("payment_id") @ExcludeMissing fun _paymentId() = paymentId + @JsonProperty("body") @ExcludeMissing fun _body() = body @JsonProperty("code") @ExcludeMissing fun _code() = code - @JsonProperty("body") @ExcludeMissing fun _body() = body + @JsonProperty("payment_id") @ExcludeMissing fun _paymentId() = paymentId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayStatementResponse = apply { if (!validated) { - paymentId() - code() body().map { it.validate() } + code() + paymentId() validated = true } } @@ -61,56 +66,55 @@ private constructor( class Builder { - private var paymentId: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() private var body: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var paymentId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payStatementResponse: PayStatementResponse) = apply { - this.paymentId = payStatementResponse.paymentId - this.code = payStatementResponse.code - this.body = payStatementResponse.body - additionalProperties(payStatementResponse.additionalProperties) + body = payStatementResponse.body + code = payStatementResponse.code + paymentId = payStatementResponse.paymentId + additionalProperties = payStatementResponse.additionalProperties.toMutableMap() } - fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) + fun body(body: PayStatementResponseBody) = body(JsonField.of(body)) - @JsonProperty("payment_id") - @ExcludeMissing - fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } + fun body(body: JsonField) = apply { this.body = body } fun code(code: Long) = code(JsonField.of(code)) - @JsonProperty("code") - @ExcludeMissing fun code(code: JsonField) = apply { this.code = code } - fun body(body: PayStatementResponseBody) = body(JsonField.of(body)) + fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField) = apply { this.body = body } + fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatementResponse = PayStatementResponse( - paymentId, - code, body, + code, + paymentId, additionalProperties.toImmutable(), ) } @@ -120,15 +124,15 @@ private constructor( return true } - return /* spotless:off */ other is PayStatementResponse && paymentId == other.paymentId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayStatementResponse && body == other.body && code == other.code && paymentId == other.paymentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(paymentId, code, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, code, paymentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayStatementResponse{paymentId=$paymentId, code=$code, body=$body, additionalProperties=$additionalProperties}" + "PayStatementResponse{body=$body, code=$code, paymentId=$paymentId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt index fb09f3f4..52acf10f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponseBody.kt @@ -4,28 +4,31 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = PayStatementResponseBody.Builder::class) @NoAutoDetect class PayStatementResponseBody +@JsonCreator private constructor( - private val paging: JsonField, - private val payStatements: JsonField>, - private val additionalProperties: Map, + @JsonProperty("paging") + @ExcludeMissing + private val paging: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + private val payStatements: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) /** The array of pay statements for the current payment. */ @@ -41,6 +44,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayStatementResponseBody = apply { if (!validated) { paging().map { it.validate() } @@ -64,15 +69,13 @@ private constructor( @JvmSynthetic internal fun from(payStatementResponseBody: PayStatementResponseBody) = apply { - this.paging = payStatementResponseBody.paging - this.payStatements = payStatementResponseBody.payStatements - additionalProperties(payStatementResponseBody.additionalProperties) + paging = payStatementResponseBody.paging + payStatements = payStatementResponseBody.payStatements + additionalProperties = payStatementResponseBody.additionalProperties.toMutableMap() } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") - @ExcludeMissing fun paging(paging: JsonField) = apply { this.paging = paging } /** The array of pay statements for the current payment. */ @@ -80,26 +83,29 @@ private constructor( payStatements(JsonField.of(payStatements)) /** The array of pay statements for the current payment. */ - @JsonProperty("pay_statements") - @ExcludeMissing fun payStatements(payStatements: JsonField>) = apply { this.payStatements = payStatements } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatementResponseBody = PayStatementResponseBody( paging, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index 3d3fab02..a5b93d14 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -6,121 +6,143 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Payment.Builder::class) @NoAutoDetect class Payment +@JsonCreator private constructor( - private val id: JsonField, - private val payPeriod: JsonField, - private val payDate: JsonField, - private val debitDate: JsonField, - private val companyDebit: JsonField, - private val grossPay: JsonField, - private val netPay: JsonField, - private val employerTaxes: JsonField, - private val employeeTaxes: JsonField, - private val individualIds: JsonField>, - private val payGroupIds: JsonField>, - private val payFrequencies: JsonField>, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("company_debit") + @ExcludeMissing + private val companyDebit: JsonField = JsonMissing.of(), + @JsonProperty("debit_date") + @ExcludeMissing + private val debitDate: JsonField = JsonMissing.of(), + @JsonProperty("employee_taxes") + @ExcludeMissing + private val employeeTaxes: JsonField = JsonMissing.of(), + @JsonProperty("employer_taxes") + @ExcludeMissing + private val employerTaxes: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + private val grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField> = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + private val netPay: JsonField = JsonMissing.of(), + @JsonProperty("pay_date") + @ExcludeMissing + private val payDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField> = JsonMissing.of(), + @JsonProperty("pay_group_ids") + @ExcludeMissing + private val payGroupIds: JsonField> = JsonMissing.of(), + @JsonProperty("pay_period") + @ExcludeMissing + private val payPeriod: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The unique id for the payment. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - /** The pay period object. */ - fun payPeriod(): Optional = Optional.ofNullable(payPeriod.getNullable("pay_period")) - - fun payDate(): Optional = Optional.ofNullable(payDate.getNullable("pay_date")) - - fun debitDate(): Optional = Optional.ofNullable(debitDate.getNullable("debit_date")) - fun companyDebit(): Optional = Optional.ofNullable(companyDebit.getNullable("company_debit")) - fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun debitDate(): Optional = Optional.ofNullable(debitDate.getNullable("debit_date")) - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + fun employeeTaxes(): Optional = + Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) fun employerTaxes(): Optional = Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) - fun employeeTaxes(): Optional = - Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + fun grossPay(): Optional = Optional.ofNullable(grossPay.getNullable("gross_pay")) /** Array of every individual on this payment. */ fun individualIds(): Optional> = Optional.ofNullable(individualIds.getNullable("individual_ids")) - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ - fun payGroupIds(): Optional> = - Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + + fun payDate(): Optional = Optional.ofNullable(payDate.getNullable("pay_date")) /** List of pay frequencies associated with this payment. */ fun payFrequencies(): Optional> = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - /** The unique id for the payment. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + fun payGroupIds(): Optional> = + Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) /** The pay period object. */ - @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod - - @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate + fun payPeriod(): Optional = Optional.ofNullable(payPeriod.getNullable("pay_period")) - @JsonProperty("debit_date") @ExcludeMissing fun _debitDate() = debitDate + /** The unique id for the payment. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("company_debit") @ExcludeMissing fun _companyDebit() = companyDebit - @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + @JsonProperty("debit_date") @ExcludeMissing fun _debitDate() = debitDate - @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes() = employeeTaxes @JsonProperty("employer_taxes") @ExcludeMissing fun _employerTaxes() = employerTaxes - @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes() = employeeTaxes + @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay /** Array of every individual on this payment. */ @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ - @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds + @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + + @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate /** List of pay frequencies associated with this payment. */ @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies + /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds + + /** The pay period object. */ + @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Payment = apply { if (!validated) { id() - payPeriod().map { it.validate() } - payDate() - debitDate() companyDebit().map { it.validate() } - grossPay().map { it.validate() } - netPay().map { it.validate() } - employerTaxes().map { it.validate() } + debitDate() employeeTaxes().map { it.validate() } + employerTaxes().map { it.validate() } + grossPay().map { it.validate() } individualIds() - payGroupIds() + netPay().map { it.validate() } + payDate() payFrequencies() + payGroupIds() + payPeriod().map { it.validate() } validated = true } } @@ -135,157 +157,140 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var payPeriod: JsonField = JsonMissing.of() - private var payDate: JsonField = JsonMissing.of() - private var debitDate: JsonField = JsonMissing.of() private var companyDebit: JsonField = JsonMissing.of() - private var grossPay: JsonField = JsonMissing.of() - private var netPay: JsonField = JsonMissing.of() - private var employerTaxes: JsonField = JsonMissing.of() + private var debitDate: JsonField = JsonMissing.of() private var employeeTaxes: JsonField = JsonMissing.of() + private var employerTaxes: JsonField = JsonMissing.of() + private var grossPay: JsonField = JsonMissing.of() private var individualIds: JsonField> = JsonMissing.of() - private var payGroupIds: JsonField> = JsonMissing.of() + private var netPay: JsonField = JsonMissing.of() + private var payDate: JsonField = JsonMissing.of() private var payFrequencies: JsonField> = JsonMissing.of() + private var payGroupIds: JsonField> = JsonMissing.of() + private var payPeriod: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payment: Payment) = apply { - this.id = payment.id - this.payPeriod = payment.payPeriod - this.payDate = payment.payDate - this.debitDate = payment.debitDate - this.companyDebit = payment.companyDebit - this.grossPay = payment.grossPay - this.netPay = payment.netPay - this.employerTaxes = payment.employerTaxes - this.employeeTaxes = payment.employeeTaxes - this.individualIds = payment.individualIds - this.payGroupIds = payment.payGroupIds - this.payFrequencies = payment.payFrequencies - additionalProperties(payment.additionalProperties) + id = payment.id + companyDebit = payment.companyDebit + debitDate = payment.debitDate + employeeTaxes = payment.employeeTaxes + employerTaxes = payment.employerTaxes + grossPay = payment.grossPay + individualIds = payment.individualIds + netPay = payment.netPay + payDate = payment.payDate + payFrequencies = payment.payFrequencies + payGroupIds = payment.payGroupIds + payPeriod = payment.payPeriod + additionalProperties = payment.additionalProperties.toMutableMap() } /** The unique id for the payment. */ fun id(id: String) = id(JsonField.of(id)) /** The unique id for the payment. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - - /** The pay period object. */ - fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) - - /** The pay period object. */ - @JsonProperty("pay_period") - @ExcludeMissing - fun payPeriod(payPeriod: JsonField) = apply { this.payPeriod = payPeriod } - - fun payDate(payDate: String) = payDate(JsonField.of(payDate)) - - @JsonProperty("pay_date") - @ExcludeMissing - fun payDate(payDate: JsonField) = apply { this.payDate = payDate } - - fun debitDate(debitDate: String) = debitDate(JsonField.of(debitDate)) - - @JsonProperty("debit_date") - @ExcludeMissing - fun debitDate(debitDate: JsonField) = apply { this.debitDate = debitDate } + fun id(id: JsonField) = apply { this.id = id } fun companyDebit(companyDebit: Money) = companyDebit(JsonField.of(companyDebit)) - @JsonProperty("company_debit") - @ExcludeMissing fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit } - fun grossPay(grossPay: Money) = grossPay(JsonField.of(grossPay)) + fun debitDate(debitDate: String) = debitDate(JsonField.of(debitDate)) - @JsonProperty("gross_pay") - @ExcludeMissing - fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } + fun debitDate(debitDate: JsonField) = apply { this.debitDate = debitDate } - fun netPay(netPay: Money) = netPay(JsonField.of(netPay)) + fun employeeTaxes(employeeTaxes: Money) = employeeTaxes(JsonField.of(employeeTaxes)) - @JsonProperty("net_pay") - @ExcludeMissing - fun netPay(netPay: JsonField) = apply { this.netPay = netPay } + fun employeeTaxes(employeeTaxes: JsonField) = apply { + this.employeeTaxes = employeeTaxes + } fun employerTaxes(employerTaxes: Money) = employerTaxes(JsonField.of(employerTaxes)) - @JsonProperty("employer_taxes") - @ExcludeMissing fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes } - fun employeeTaxes(employeeTaxes: Money) = employeeTaxes(JsonField.of(employeeTaxes)) + fun grossPay(grossPay: Money) = grossPay(JsonField.of(grossPay)) - @JsonProperty("employee_taxes") - @ExcludeMissing - fun employeeTaxes(employeeTaxes: JsonField) = apply { - this.employeeTaxes = employeeTaxes - } + fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } /** Array of every individual on this payment. */ fun individualIds(individualIds: List) = individualIds(JsonField.of(individualIds)) /** Array of every individual on this payment. */ - @JsonProperty("individual_ids") - @ExcludeMissing fun individualIds(individualIds: JsonField>) = apply { this.individualIds = individualIds } - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ - fun payGroupIds(payGroupIds: List) = payGroupIds(JsonField.of(payGroupIds)) + fun netPay(netPay: Money) = netPay(JsonField.of(netPay)) - /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ - @JsonProperty("pay_group_ids") - @ExcludeMissing - fun payGroupIds(payGroupIds: JsonField>) = apply { - this.payGroupIds = payGroupIds - } + fun netPay(netPay: JsonField) = apply { this.netPay = netPay } + + fun payDate(payDate: String) = payDate(JsonField.of(payDate)) + + fun payDate(payDate: JsonField) = apply { this.payDate = payDate } /** List of pay frequencies associated with this payment. */ fun payFrequencies(payFrequencies: List) = payFrequencies(JsonField.of(payFrequencies)) /** List of pay frequencies associated with this payment. */ - @JsonProperty("pay_frequencies") - @ExcludeMissing fun payFrequencies(payFrequencies: JsonField>) = apply { this.payFrequencies = payFrequencies } + /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + fun payGroupIds(payGroupIds: List) = payGroupIds(JsonField.of(payGroupIds)) + + /** Array of the Finch id (uuidv4) of every pay group associated with this payment. */ + fun payGroupIds(payGroupIds: JsonField>) = apply { + this.payGroupIds = payGroupIds + } + + /** The pay period object. */ + fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) + + /** The pay period object. */ + fun payPeriod(payPeriod: JsonField) = apply { this.payPeriod = payPeriod } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Payment = Payment( id, - payPeriod, - payDate, - debitDate, companyDebit, - grossPay, - netPay, - employerTaxes, + debitDate, employeeTaxes, + employerTaxes, + grossPay, individualIds.map { it.toImmutable() }, - payGroupIds.map { it.toImmutable() }, + netPay, + payDate, payFrequencies.map { it.toImmutable() }, + payGroupIds.map { it.toImmutable() }, + payPeriod, additionalProperties.toImmutable(), ) } @@ -390,33 +395,38 @@ private constructor( } /** The pay period object. */ - @JsonDeserialize(builder = PayPeriod.Builder::class) @NoAutoDetect class PayPeriod + @JsonCreator private constructor( - private val startDate: JsonField, - private val endDate: JsonField, - private val additionalProperties: Map, + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayPeriod = apply { if (!validated) { - startDate() endDate() + startDate() validated = true } } @@ -430,47 +440,48 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payPeriod: PayPeriod) = apply { - this.startDate = payPeriod.startDate - this.endDate = payPeriod.endDate - additionalProperties(payPeriod.additionalProperties) + endDate = payPeriod.endDate + startDate = payPeriod.startDate + additionalProperties = payPeriod.additionalProperties.toMutableMap() } - 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 } + fun startDate(startDate: String) = startDate(JsonField.of(startDate)) + + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayPeriod = PayPeriod( - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -480,17 +491,17 @@ private constructor( return true } - return /* spotless:off */ other is PayPeriod && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayPeriod && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayPeriod{startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "PayPeriod{endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -498,15 +509,15 @@ private constructor( return true } - return /* spotless:off */ other is Payment && id == other.id && payPeriod == other.payPeriod && payDate == other.payDate && debitDate == other.debitDate && companyDebit == other.companyDebit && grossPay == other.grossPay && netPay == other.netPay && employerTaxes == other.employerTaxes && employeeTaxes == other.employeeTaxes && individualIds == other.individualIds && payGroupIds == other.payGroupIds && payFrequencies == other.payFrequencies && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Payment && id == other.id && companyDebit == other.companyDebit && debitDate == other.debitDate && employeeTaxes == other.employeeTaxes && employerTaxes == other.employerTaxes && grossPay == other.grossPay && individualIds == other.individualIds && netPay == other.netPay && payDate == other.payDate && payFrequencies == other.payFrequencies && payGroupIds == other.payGroupIds && payPeriod == other.payPeriod && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, payPeriod, payDate, debitDate, companyDebit, grossPay, netPay, employerTaxes, employeeTaxes, individualIds, payGroupIds, payFrequencies, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, companyDebit, debitDate, employeeTaxes, employerTaxes, grossPay, individualIds, netPay, payDate, payFrequencies, payGroupIds, payPeriod, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Payment{id=$id, payPeriod=$payPeriod, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payGroupIds=$payGroupIds, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" + "Payment{id=$id, companyDebit=$companyDebit, debitDate=$debitDate, employeeTaxes=$employeeTaxes, employerTaxes=$employerTaxes, grossPay=$grossPay, individualIds=$individualIds, netPay=$netPay, payDate=$payDate, payFrequencies=$payFrequencies, payGroupIds=$payGroupIds, payPeriod=$payPeriod, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt index 37c061f6..06534456 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentCreateResponse.kt @@ -4,47 +4,52 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = PaymentCreateResponse.Builder::class) @NoAutoDetect class PaymentCreateResponse +@JsonCreator private constructor( - private val paymentId: JsonField, - private val payDate: JsonField, - private val additionalProperties: Map, + @JsonProperty("pay_date") + @ExcludeMissing + private val payDate: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") + @ExcludeMissing + private val paymentId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The date of the payment. */ + fun payDate(): String = payDate.getRequired("pay_date") /** The ID of the payment. */ fun paymentId(): String = paymentId.getRequired("payment_id") /** The date of the payment. */ - fun payDate(): String = payDate.getRequired("pay_date") + @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate /** 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 + private var validated: Boolean = false + fun validate(): PaymentCreateResponse = apply { if (!validated) { - paymentId() payDate() + paymentId() validated = true } } @@ -58,51 +63,52 @@ private constructor( class Builder { - private var paymentId: JsonField = JsonMissing.of() private var payDate: JsonField = JsonMissing.of() + private var paymentId: 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) + payDate = paymentCreateResponse.payDate + paymentId = paymentCreateResponse.paymentId + additionalProperties = paymentCreateResponse.additionalProperties.toMutableMap() } - /** 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 } + /** The ID of the payment. */ + fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) + + /** The ID of the payment. */ + fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PaymentCreateResponse = PaymentCreateResponse( - paymentId, payDate, + paymentId, additionalProperties.toImmutable(), ) } @@ -112,15 +118,15 @@ private constructor( return true } - return /* spotless:off */ other is PaymentCreateResponse && paymentId == other.paymentId && payDate == other.payDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentCreateResponse && payDate == other.payDate && paymentId == other.paymentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(paymentId, payDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(payDate, paymentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentCreateResponse{paymentId=$paymentId, payDate=$payDate, additionalProperties=$additionalProperties}" + "PaymentCreateResponse{payDate=$payDate, paymentId=$paymentId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index 1be91fee..19777058 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -6,89 +6,99 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = PaymentEvent.Builder::class) @NoAutoDetect class PaymentEvent +@JsonCreator private constructor( - private val connectionId: JsonField, - private val companyId: JsonField, - private val accountId: JsonField, - private val eventType: JsonField, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("account_id") + @ExcludeMissing + private val accountId: JsonField = JsonMissing.of(), + @JsonProperty("company_id") + @ExcludeMissing + private val companyId: JsonField = JsonMissing.of(), + @JsonProperty("connection_id") + @ExcludeMissing + private val connectionId: JsonField = JsonMissing.of(), + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + private val eventType: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(): Optional = - Optional.ofNullable(connectionId.getNullable("connection_id")) - /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(): String = companyId.getRequired("company_id") + fun accountId(): String = accountId.getRequired("account_id") /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(): String = accountId.getRequired("account_id") + fun companyId(): String = companyId.getRequired("company_id") - fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(): Optional = + Optional.ofNullable(connectionId.getNullable("connection_id")) fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - fun toBaseWebhookEvent(): BaseWebhookEvent = - BaseWebhookEvent.builder() - .connectionId(connectionId) - .companyId(companyId) - .accountId(accountId) - .build() - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId + fun eventType(): Optional = Optional.ofNullable(eventType.getNullable("event_type")) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId + @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId + @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId - @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + /** Unique Finch ID of the connection associated with the webhook event. */ + @JsonProperty("connection_id") @ExcludeMissing fun _connectionId() = connectionId @JsonProperty("data") @ExcludeMissing fun _data() = data + @JsonProperty("event_type") @ExcludeMissing fun _eventType() = eventType + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + fun toBaseWebhookEvent(): BaseWebhookEvent = + BaseWebhookEvent.builder() + .accountId(accountId) + .companyId(companyId) + .connectionId(connectionId) + .build() + + private var validated: Boolean = false + fun validate(): PaymentEvent = apply { if (!validated) { - connectionId() - companyId() accountId() - eventType() + companyId() + connectionId() data().map { it.validate() } + eventType() validated = true } } @@ -102,129 +112,129 @@ private constructor( class Builder { - private var connectionId: JsonField = JsonMissing.of() - private var companyId: JsonField = JsonMissing.of() private var accountId: JsonField = JsonMissing.of() - private var eventType: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var connectionId: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var eventType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentEvent: PaymentEvent) = apply { - this.connectionId = paymentEvent.connectionId - this.companyId = paymentEvent.companyId - this.accountId = paymentEvent.accountId - this.eventType = paymentEvent.eventType - this.data = paymentEvent.data - additionalProperties(paymentEvent.additionalProperties) - } - - /** Unique Finch ID of the connection associated with the webhook event. */ - fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - - /** Unique Finch ID of the connection associated with the webhook event. */ - @JsonProperty("connection_id") - @ExcludeMissing - fun connectionId(connectionId: JsonField) = apply { - this.connectionId = connectionId + accountId = paymentEvent.accountId + companyId = paymentEvent.companyId + connectionId = paymentEvent.connectionId + data = paymentEvent.data + eventType = paymentEvent.eventType + additionalProperties = paymentEvent.additionalProperties.toMutableMap() } /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** - * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use + * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("company_id") - @ExcludeMissing - fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + fun companyId(companyId: String) = companyId(JsonField.of(companyId)) /** - * [DEPRECATED] Unique Finch ID of the employer account used to make this connection. Use + * [DEPRECATED] Unique Finch ID of the company for which data has been updated. Use * `connection_id` instead to identify the connection associated with this event. */ - @JsonProperty("account_id") - @ExcludeMissing - fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } - fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) - @JsonProperty("event_type") - @ExcludeMissing - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + /** Unique Finch ID of the connection associated with the webhook event. */ + fun connectionId(connectionId: JsonField) = apply { + this.connectionId = connectionId + } fun data(data: PaymentIdentifiers) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PaymentEvent = PaymentEvent( - connectionId, - companyId, accountId, - eventType, + companyId, + connectionId, data, + eventType, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = PaymentIdentifiers.Builder::class) @NoAutoDetect class PaymentIdentifiers + @JsonCreator private constructor( - private val paymentId: JsonField, - private val payDate: JsonField, - private val additionalProperties: Map, + @JsonProperty("pay_date") + @ExcludeMissing + private val payDate: JsonField = JsonMissing.of(), + @JsonProperty("payment_id") + @ExcludeMissing + private val paymentId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The date of the payment. */ + fun payDate(): String = payDate.getRequired("pay_date") /** The ID of the payment. */ fun paymentId(): String = paymentId.getRequired("payment_id") /** The date of the payment. */ - fun payDate(): String = payDate.getRequired("pay_date") + @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate /** 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 + private var validated: Boolean = false + fun validate(): PaymentIdentifiers = apply { if (!validated) { - paymentId() payDate() + paymentId() validated = true } } @@ -238,51 +248,52 @@ private constructor( class Builder { - private var paymentId: JsonField = JsonMissing.of() private var payDate: JsonField = JsonMissing.of() + private var paymentId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(paymentIdentifiers: PaymentIdentifiers) = apply { - this.paymentId = paymentIdentifiers.paymentId - this.payDate = paymentIdentifiers.payDate - additionalProperties(paymentIdentifiers.additionalProperties) + payDate = paymentIdentifiers.payDate + paymentId = paymentIdentifiers.paymentId + additionalProperties = paymentIdentifiers.additionalProperties.toMutableMap() } - /** 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 } + /** The ID of the payment. */ + fun paymentId(paymentId: String) = paymentId(JsonField.of(paymentId)) + + /** The ID of the payment. */ + fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PaymentIdentifiers = PaymentIdentifiers( - paymentId, payDate, + paymentId, additionalProperties.toImmutable(), ) } @@ -292,17 +303,17 @@ private constructor( return true } - return /* spotless:off */ other is PaymentIdentifiers && paymentId == other.paymentId && payDate == other.payDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentIdentifiers && payDate == other.payDate && paymentId == other.paymentId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(paymentId, payDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(payDate, paymentId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentIdentifiers{paymentId=$paymentId, payDate=$payDate, additionalProperties=$additionalProperties}" + "PaymentIdentifiers{payDate=$payDate, paymentId=$paymentId, additionalProperties=$additionalProperties}" } class EventType @@ -373,15 +384,15 @@ private constructor( return true } - return /* spotless:off */ other is PaymentEvent && connectionId == other.connectionId && companyId == other.companyId && accountId == other.accountId && eventType == other.eventType && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PaymentEvent && accountId == other.accountId && companyId == other.companyId && connectionId == other.connectionId && data == other.data && eventType == other.eventType && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(connectionId, companyId, accountId, eventType, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountId, companyId, connectionId, data, eventType, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PaymentEvent{connectionId=$connectionId, companyId=$companyId, accountId=$accountId, eventType=$eventType, data=$data, additionalProperties=$additionalProperties}" + "PaymentEvent{accountId=$accountId, companyId=$companyId, connectionId=$connectionId, data=$data, eventType=$eventType, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index fbc6589d..5d6d47b4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.payroll.PayGroupService import java.util.Objects @@ -71,12 +72,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -130,10 +133,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index 915dd966..a59f56bf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.payroll.PayGroupServiceAsync import java.util.Objects @@ -74,12 +75,14 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") + private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,10 +136,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt index 96fa9258..023edbab 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListParams.kt @@ -47,27 +47,32 @@ constructor( class Builder { private var individualId: String? = null - private var payFrequencies: MutableList = mutableListOf() + private var payFrequencies: MutableList? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(payrollPayGroupListParams: PayrollPayGroupListParams) = apply { individualId = payrollPayGroupListParams.individualId - payFrequencies = - payrollPayGroupListParams.payFrequencies?.toMutableList() ?: mutableListOf() + payFrequencies = payrollPayGroupListParams.payFrequencies?.toMutableList() additionalHeaders = payrollPayGroupListParams.additionalHeaders.toBuilder() additionalQueryParams = payrollPayGroupListParams.additionalQueryParams.toBuilder() } - fun individualId(individualId: String) = apply { this.individualId = individualId } + fun individualId(individualId: String?) = apply { this.individualId = individualId } - fun payFrequencies(payFrequencies: List) = apply { - this.payFrequencies.clear() - this.payFrequencies.addAll(payFrequencies) + fun individualId(individualId: Optional) = individualId(individualId.orElse(null)) + + fun payFrequencies(payFrequencies: List?) = apply { + this.payFrequencies = payFrequencies?.toMutableList() } - fun addPayFrequency(payFrequency: String) = apply { this.payFrequencies.add(payFrequency) } + fun payFrequencies(payFrequencies: Optional>) = + payFrequencies(payFrequencies.orElse(null)) + + fun addPayFrequency(payFrequency: String) = apply { + payFrequencies = (payFrequencies ?: mutableListOf()).apply { add(payFrequency) } + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -170,7 +175,7 @@ constructor( fun build(): PayrollPayGroupListParams = PayrollPayGroupListParams( individualId, - payFrequencies.toImmutable().ifEmpty { null }, + payFrequencies?.toImmutable(), additionalHeaders.build(), additionalQueryParams.build(), ) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index d42d4889..364184d0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -6,53 +6,74 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Provider.Builder::class) @NoAutoDetect class Provider +@JsonCreator private constructor( - private val id: JsonField, - private val displayName: JsonField, - private val products: JsonField>, - private val icon: JsonField, - private val logo: JsonField, - private val mfaRequired: JsonField, - private val primaryColor: JsonField, - private val manual: JsonField, - private val beta: JsonField, - private val authenticationMethods: JsonField>, - private val additionalProperties: Map, + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("authentication_methods") + @ExcludeMissing + private val authenticationMethods: JsonField> = JsonMissing.of(), + @JsonProperty("beta") @ExcludeMissing private val beta: JsonField = JsonMissing.of(), + @JsonProperty("display_name") + @ExcludeMissing + private val displayName: JsonField = JsonMissing.of(), + @JsonProperty("icon") @ExcludeMissing private val icon: JsonField = JsonMissing.of(), + @JsonProperty("logo") @ExcludeMissing private val logo: JsonField = JsonMissing.of(), + @JsonProperty("manual") + @ExcludeMissing + private val manual: JsonField = JsonMissing.of(), + @JsonProperty("mfa_required") + @ExcludeMissing + private val mfaRequired: JsonField = JsonMissing.of(), + @JsonProperty("primary_color") + @ExcludeMissing + private val primaryColor: JsonField = JsonMissing.of(), + @JsonProperty("products") + @ExcludeMissing + private val products: JsonField> = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - /** The id of the payroll provider used in Connect. */ fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + /** The list of authentication methods supported by the provider. */ + fun authenticationMethods(): Optional> = + Optional.ofNullable(authenticationMethods.getNullable("authentication_methods")) + + /** `true` if the integration is in a beta state, `false` otherwise */ + fun beta(): Optional = Optional.ofNullable(beta.getNullable("beta")) + /** The display name of the payroll provider. */ fun displayName(): Optional = Optional.ofNullable(displayName.getNullable("display_name")) - /** The list of Finch products supported on this payroll provider. */ - fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) - /** The url to the official icon of the payroll provider. */ fun icon(): Optional = Optional.ofNullable(icon.getNullable("icon")) /** The url to the official logo of the payroll provider. */ fun logo(): Optional = Optional.ofNullable(logo.getNullable("logo")) + /** + * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow + * by default. This field is now deprecated. Please check for a `type` of `assisted` in the + * `authentication_methods` field instead. + */ + fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) + /** whether MFA is required for the provider. */ fun mfaRequired(): Optional = Optional.ofNullable(mfaRequired.getNullable("mfa_required")) @@ -61,41 +82,29 @@ private constructor( fun primaryColor(): Optional = Optional.ofNullable(primaryColor.getNullable("primary_color")) - /** - * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow - * by default. This field is now deprecated. Please check for a `type` of `assisted` in the - * `authentication_methods` field instead. - */ - fun manual(): Optional = Optional.ofNullable(manual.getNullable("manual")) + /** The list of Finch products supported on this payroll provider. */ + fun products(): Optional> = Optional.ofNullable(products.getNullable("products")) - /** `true` if the integration is in a beta state, `false` otherwise */ - fun beta(): Optional = Optional.ofNullable(beta.getNullable("beta")) + /** The id of the payroll provider used in Connect. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id /** The list of authentication methods supported by the provider. */ - fun authenticationMethods(): Optional> = - Optional.ofNullable(authenticationMethods.getNullable("authentication_methods")) + @JsonProperty("authentication_methods") + @ExcludeMissing + fun _authenticationMethods() = authenticationMethods - /** The id of the payroll provider used in Connect. */ - @JsonProperty("id") @ExcludeMissing fun _id() = id + /** `true` if the integration is in a beta state, `false` otherwise */ + @JsonProperty("beta") @ExcludeMissing fun _beta() = beta /** The display name of the payroll provider. */ @JsonProperty("display_name") @ExcludeMissing fun _displayName() = displayName - /** The list of Finch products supported on this payroll provider. */ - @JsonProperty("products") @ExcludeMissing fun _products() = products - /** The url to the official icon of the payroll provider. */ @JsonProperty("icon") @ExcludeMissing fun _icon() = icon /** The url to the official logo of the payroll provider. */ @JsonProperty("logo") @ExcludeMissing fun _logo() = logo - /** whether MFA is required for the provider. */ - @JsonProperty("mfa_required") @ExcludeMissing fun _mfaRequired() = mfaRequired - - /** The hex code for the primary color of the payroll provider. */ - @JsonProperty("primary_color") @ExcludeMissing fun _primaryColor() = primaryColor - /** * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect Flow * by default. This field is now deprecated. Please check for a `type` of `assisted` in the @@ -103,30 +112,33 @@ private constructor( */ @JsonProperty("manual") @ExcludeMissing fun _manual() = manual - /** `true` if the integration is in a beta state, `false` otherwise */ - @JsonProperty("beta") @ExcludeMissing fun _beta() = beta + /** whether MFA is required for the provider. */ + @JsonProperty("mfa_required") @ExcludeMissing fun _mfaRequired() = mfaRequired - /** The list of authentication methods supported by the provider. */ - @JsonProperty("authentication_methods") - @ExcludeMissing - fun _authenticationMethods() = authenticationMethods + /** The hex code for the primary color of the payroll provider. */ + @JsonProperty("primary_color") @ExcludeMissing fun _primaryColor() = primaryColor + + /** The list of Finch products supported on this payroll provider. */ + @JsonProperty("products") @ExcludeMissing fun _products() = products @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Provider = apply { if (!validated) { id() + authenticationMethods().map { it.forEach { it.validate() } } + beta() displayName() - products() icon() logo() + manual() mfaRequired() primaryColor() - manual() - beta() - authenticationMethods().map { it.forEach { it.validate() } } + products() validated = true } } @@ -141,88 +153,72 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var authenticationMethods: JsonField> = JsonMissing.of() + private var beta: JsonField = JsonMissing.of() private var displayName: JsonField = JsonMissing.of() - private var products: JsonField> = JsonMissing.of() private var icon: JsonField = JsonMissing.of() private var logo: JsonField = JsonMissing.of() + private var manual: JsonField = JsonMissing.of() private var mfaRequired: JsonField = JsonMissing.of() private var primaryColor: JsonField = JsonMissing.of() - private var manual: JsonField = JsonMissing.of() - private var beta: JsonField = JsonMissing.of() - private var authenticationMethods: JsonField> = JsonMissing.of() + private var products: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(provider: Provider) = apply { - this.id = provider.id - this.displayName = provider.displayName - this.products = provider.products - this.icon = provider.icon - this.logo = provider.logo - this.mfaRequired = provider.mfaRequired - this.primaryColor = provider.primaryColor - this.manual = provider.manual - this.beta = provider.beta - this.authenticationMethods = provider.authenticationMethods - additionalProperties(provider.additionalProperties) + id = provider.id + authenticationMethods = provider.authenticationMethods + beta = provider.beta + displayName = provider.displayName + icon = provider.icon + logo = provider.logo + manual = provider.manual + mfaRequired = provider.mfaRequired + primaryColor = provider.primaryColor + products = provider.products + additionalProperties = provider.additionalProperties.toMutableMap() } /** The id of the payroll provider used in Connect. */ fun id(id: String) = id(JsonField.of(id)) /** The id of the payroll provider used in Connect. */ - @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun id(id: JsonField) = apply { this.id = id } + + /** The list of authentication methods supported by the provider. */ + fun authenticationMethods(authenticationMethods: List) = + authenticationMethods(JsonField.of(authenticationMethods)) + + /** The list of authentication methods supported by the provider. */ + fun authenticationMethods(authenticationMethods: JsonField>) = + apply { + this.authenticationMethods = authenticationMethods + } + + /** `true` if the integration is in a beta state, `false` otherwise */ + fun beta(beta: Boolean) = beta(JsonField.of(beta)) + + /** `true` if the integration is in a beta state, `false` otherwise */ + fun beta(beta: JsonField) = apply { this.beta = beta } /** The display name of the payroll provider. */ fun displayName(displayName: String) = displayName(JsonField.of(displayName)) /** The display name of the payroll provider. */ - @JsonProperty("display_name") - @ExcludeMissing fun displayName(displayName: JsonField) = apply { this.displayName = displayName } - /** The list of Finch products supported on this payroll provider. */ - fun products(products: List) = products(JsonField.of(products)) - - /** The list of Finch products supported on this payroll provider. */ - @JsonProperty("products") - @ExcludeMissing - fun products(products: JsonField>) = apply { this.products = products } - /** The url to the official icon of the payroll provider. */ fun icon(icon: String) = icon(JsonField.of(icon)) /** The url to the official icon of the payroll provider. */ - @JsonProperty("icon") - @ExcludeMissing fun icon(icon: JsonField) = apply { this.icon = icon } /** The url to the official logo of the payroll provider. */ fun logo(logo: String) = logo(JsonField.of(logo)) /** The url to the official logo of the payroll provider. */ - @JsonProperty("logo") - @ExcludeMissing fun logo(logo: JsonField) = apply { this.logo = logo } - /** whether MFA is required for the provider. */ - fun mfaRequired(mfaRequired: Boolean) = mfaRequired(JsonField.of(mfaRequired)) - - /** whether MFA is required for the provider. */ - @JsonProperty("mfa_required") - @ExcludeMissing - fun mfaRequired(mfaRequired: JsonField) = apply { this.mfaRequired = mfaRequired } - - /** The hex code for the primary color of the payroll provider. */ - fun primaryColor(primaryColor: String) = primaryColor(JsonField.of(primaryColor)) - - /** The hex code for the primary color of the payroll provider. */ - @JsonProperty("primary_color") - @ExcludeMissing - fun primaryColor(primaryColor: JsonField) = apply { - this.primaryColor = primaryColor - } - /** * [DEPRECATED] Whether the Finch integration with this provider uses the Assisted Connect * Flow by default. This field is now deprecated. Please check for a `type` of `assisted` in @@ -235,75 +231,78 @@ private constructor( * Flow by default. This field is now deprecated. Please check for a `type` of `assisted` in * the `authentication_methods` field instead. */ - @JsonProperty("manual") - @ExcludeMissing fun manual(manual: JsonField) = apply { this.manual = manual } - /** `true` if the integration is in a beta state, `false` otherwise */ - fun beta(beta: Boolean) = beta(JsonField.of(beta)) + /** whether MFA is required for the provider. */ + fun mfaRequired(mfaRequired: Boolean) = mfaRequired(JsonField.of(mfaRequired)) - /** `true` if the integration is in a beta state, `false` otherwise */ - @JsonProperty("beta") - @ExcludeMissing - fun beta(beta: JsonField) = apply { this.beta = beta } + /** whether MFA is required for the provider. */ + fun mfaRequired(mfaRequired: JsonField) = apply { this.mfaRequired = mfaRequired } - /** The list of authentication methods supported by the provider. */ - fun authenticationMethods(authenticationMethods: List) = - authenticationMethods(JsonField.of(authenticationMethods)) + /** The hex code for the primary color of the payroll provider. */ + fun primaryColor(primaryColor: String) = primaryColor(JsonField.of(primaryColor)) - /** The list of authentication methods supported by the provider. */ - @JsonProperty("authentication_methods") - @ExcludeMissing - fun authenticationMethods(authenticationMethods: JsonField>) = - apply { - this.authenticationMethods = authenticationMethods - } + /** The hex code for the primary color of the payroll provider. */ + fun primaryColor(primaryColor: JsonField) = apply { + this.primaryColor = primaryColor + } + + /** The list of Finch products supported on this payroll provider. */ + fun products(products: List) = products(JsonField.of(products)) + + /** The list of Finch products supported on this payroll provider. */ + fun products(products: JsonField>) = apply { this.products = products } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Provider = Provider( id, + authenticationMethods.map { it.toImmutable() }, + beta, displayName, - products.map { it.toImmutable() }, icon, logo, + manual, mfaRequired, primaryColor, - manual, - beta, - authenticationMethods.map { it.toImmutable() }, + products.map { it.toImmutable() }, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = AuthenticationMethod.Builder::class) @NoAutoDetect class AuthenticationMethod + @JsonCreator private constructor( - private val type: JsonField, - private val benefitsSupport: JsonField, - private val supportedFields: JsonField, - private val additionalProperties: Map, + @JsonProperty("benefits_support") + @ExcludeMissing + private val benefitsSupport: JsonField = JsonMissing.of(), + @JsonProperty("supported_fields") + @ExcludeMissing + private val supportedFields: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** The type of authentication method. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - /** * Each benefit type and their supported features. If the benefit type is not supported, the * property will be null @@ -316,7 +315,7 @@ private constructor( Optional.ofNullable(supportedFields.getNullable("supported_fields")) /** The type of authentication method. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** * Each benefit type and their supported features. If the benefit type is not supported, the @@ -327,15 +326,20 @@ private constructor( /** The supported data fields returned by our HR and payroll endpoints */ @JsonProperty("supported_fields") @ExcludeMissing fun _supportedFields() = supportedFields + /** The type of authentication method. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): AuthenticationMethod = apply { if (!validated) { - type() benefitsSupport().map { it.validate() } supportedFields().map { it.validate() } + type() validated = true } } @@ -349,27 +353,19 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var benefitsSupport: JsonField = JsonMissing.of() private var supportedFields: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(authenticationMethod: AuthenticationMethod) = apply { - this.type = authenticationMethod.type - this.benefitsSupport = authenticationMethod.benefitsSupport - this.supportedFields = authenticationMethod.supportedFields - additionalProperties(authenticationMethod.additionalProperties) + benefitsSupport = authenticationMethod.benefitsSupport + supportedFields = authenticationMethod.supportedFields + type = authenticationMethod.type + additionalProperties = authenticationMethod.additionalProperties.toMutableMap() } - /** The type of authentication method. */ - fun type(type: Type) = type(JsonField.of(type)) - - /** The type of authentication method. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - /** * Each benefit type and their supported features. If the benefit type is not supported, * the property will be null @@ -381,8 +377,6 @@ private constructor( * Each benefit type and their supported features. If the benefit type is not supported, * the property will be null */ - @JsonProperty("benefits_support") - @ExcludeMissing fun benefitsSupport(benefitsSupport: JsonField) = apply { this.benefitsSupport = benefitsSupport } @@ -392,100 +386,124 @@ private constructor( supportedFields(JsonField.of(supportedFields)) /** The supported data fields returned by our HR and payroll endpoints */ - @JsonProperty("supported_fields") - @ExcludeMissing fun supportedFields(supportedFields: JsonField) = apply { this.supportedFields = supportedFields } + /** The type of authentication method. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The type of authentication method. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): AuthenticationMethod = AuthenticationMethod( - type, benefitsSupport, supportedFields, + type, additionalProperties.toImmutable(), ) } /** The supported data fields returned by our HR and payroll endpoints */ - @JsonDeserialize(builder = SupportedFields.Builder::class) @NoAutoDetect class SupportedFields + @JsonCreator private constructor( - private val company: JsonField, - private val directory: JsonField, - private val individual: JsonField, - private val employment: JsonField, - private val payment: JsonField, - private val payStatement: JsonField, - private val payGroup: JsonField, - private val additionalProperties: Map, + @JsonProperty("company") + @ExcludeMissing + private val company: JsonField = JsonMissing.of(), + @JsonProperty("directory") + @ExcludeMissing + private val directory: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + private val employment: JsonField = JsonMissing.of(), + @JsonProperty("individual") + @ExcludeMissing + private val individual: JsonField = JsonMissing.of(), + @JsonProperty("pay_group") + @ExcludeMissing + private val payGroup: JsonField = JsonMissing.of(), + @JsonProperty("pay_statement") + @ExcludeMissing + private val payStatement: JsonField = JsonMissing.of(), + @JsonProperty("payment") + @ExcludeMissing + private val payment: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun company(): Optional = Optional.ofNullable(company.getNullable("company")) fun directory(): Optional = Optional.ofNullable(directory.getNullable("directory")) - fun individual(): Optional = - Optional.ofNullable(individual.getNullable("individual")) - fun employment(): Optional = Optional.ofNullable(employment.getNullable("employment")) - fun payment(): Optional = - Optional.ofNullable(payment.getNullable("payment")) + fun individual(): Optional = + Optional.ofNullable(individual.getNullable("individual")) + + fun payGroup(): Optional = + Optional.ofNullable(payGroup.getNullable("pay_group")) fun payStatement(): Optional = Optional.ofNullable(payStatement.getNullable("pay_statement")) - fun payGroup(): Optional = - Optional.ofNullable(payGroup.getNullable("pay_group")) + fun payment(): Optional = + Optional.ofNullable(payment.getNullable("payment")) @JsonProperty("company") @ExcludeMissing fun _company() = company @JsonProperty("directory") @ExcludeMissing fun _directory() = directory - @JsonProperty("individual") @ExcludeMissing fun _individual() = individual - @JsonProperty("employment") @ExcludeMissing fun _employment() = employment - @JsonProperty("payment") @ExcludeMissing fun _payment() = payment + @JsonProperty("individual") @ExcludeMissing fun _individual() = individual + + @JsonProperty("pay_group") @ExcludeMissing fun _payGroup() = payGroup @JsonProperty("pay_statement") @ExcludeMissing fun _payStatement() = payStatement - @JsonProperty("pay_group") @ExcludeMissing fun _payGroup() = payGroup + @JsonProperty("payment") @ExcludeMissing fun _payment() = payment @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedFields = apply { if (!validated) { company().map { it.validate() } directory().map { it.validate() } - individual().map { it.validate() } employment().map { it.validate() } - payment().map { it.validate() } - payStatement().map { it.validate() } + individual().map { it.validate() } payGroup().map { it.validate() } + payStatement().map { it.validate() } + payment().map { it.validate() } validated = true } } @@ -501,29 +519,27 @@ private constructor( private var company: JsonField = JsonMissing.of() private var directory: JsonField = JsonMissing.of() - private var individual: JsonField = JsonMissing.of() private var employment: JsonField = JsonMissing.of() - private var payment: JsonField = JsonMissing.of() - private var payStatement: JsonField = JsonMissing.of() + private var individual: JsonField = JsonMissing.of() private var payGroup: JsonField = JsonMissing.of() + private var payStatement: JsonField = JsonMissing.of() + private var payment: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedFields: SupportedFields) = apply { - this.company = supportedFields.company - this.directory = supportedFields.directory - this.individual = supportedFields.individual - this.employment = supportedFields.employment - this.payment = supportedFields.payment - this.payStatement = supportedFields.payStatement - this.payGroup = supportedFields.payGroup - additionalProperties(supportedFields.additionalProperties) + company = supportedFields.company + directory = supportedFields.directory + employment = supportedFields.employment + individual = supportedFields.individual + payGroup = supportedFields.payGroup + payStatement = supportedFields.payStatement + payment = supportedFields.payment + additionalProperties = supportedFields.additionalProperties.toMutableMap() } fun company(company: SupportedCompanyFields) = company(JsonField.of(company)) - @JsonProperty("company") - @ExcludeMissing fun company(company: JsonField) = apply { this.company = company } @@ -531,63 +547,50 @@ private constructor( fun directory(directory: SupportedDirectoryFields) = directory(JsonField.of(directory)) - @JsonProperty("directory") - @ExcludeMissing fun directory(directory: JsonField) = apply { this.directory = directory } - fun individual(individual: SupportedIndividualFields) = - individual(JsonField.of(individual)) - - @JsonProperty("individual") - @ExcludeMissing - fun individual(individual: JsonField) = apply { - this.individual = individual - } - fun employment(employment: SupportedEmploymentFields) = employment(JsonField.of(employment)) - @JsonProperty("employment") - @ExcludeMissing fun employment(employment: JsonField) = apply { this.employment = employment } - fun payment(payment: SupportedPaymentFields) = payment(JsonField.of(payment)) + fun individual(individual: SupportedIndividualFields) = + individual(JsonField.of(individual)) - @JsonProperty("payment") - @ExcludeMissing - fun payment(payment: JsonField) = apply { - this.payment = payment + fun individual(individual: JsonField) = apply { + this.individual = individual + } + + fun payGroup(payGroup: SupportedPayGroupFields) = payGroup(JsonField.of(payGroup)) + + fun payGroup(payGroup: JsonField) = apply { + this.payGroup = payGroup } fun payStatement(payStatement: SupportedPayStatementFields) = payStatement(JsonField.of(payStatement)) - @JsonProperty("pay_statement") - @ExcludeMissing fun payStatement(payStatement: JsonField) = apply { this.payStatement = payStatement } - fun payGroup(payGroup: SupportedPayGroupFields) = payGroup(JsonField.of(payGroup)) + fun payment(payment: SupportedPaymentFields) = payment(JsonField.of(payment)) - @JsonProperty("pay_group") - @ExcludeMissing - fun payGroup(payGroup: JsonField) = apply { - this.payGroup = payGroup + fun payment(payment: JsonField) = apply { + this.payment = payment } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -595,43 +598,79 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedFields = SupportedFields( company, directory, - individual, employment, - payment, - payStatement, + individual, payGroup, + payStatement, + payment, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = SupportedCompanyFields.Builder::class) @NoAutoDetect class SupportedCompanyFields + @JsonCreator private constructor( - private val id: JsonField, - private val legalName: JsonField, - private val entity: JsonField, - private val primaryEmail: JsonField, - private val primaryPhoneNumber: JsonField, - private val ein: JsonField, - private val accounts: JsonField, - private val departments: JsonField, - private val locations: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("accounts") + @ExcludeMissing + private val accounts: JsonField = JsonMissing.of(), + @JsonProperty("departments") + @ExcludeMissing + private val departments: JsonField = JsonMissing.of(), + @JsonProperty("ein") + @ExcludeMissing + private val ein: JsonField = JsonMissing.of(), + @JsonProperty("entity") + @ExcludeMissing + private val entity: JsonField = JsonMissing.of(), + @JsonProperty("legal_name") + @ExcludeMissing + private val legalName: JsonField = JsonMissing.of(), + @JsonProperty("locations") + @ExcludeMissing + private val locations: JsonField = JsonMissing.of(), + @JsonProperty("primary_email") + @ExcludeMissing + private val primaryEmail: JsonField = JsonMissing.of(), + @JsonProperty("primary_phone_number") + @ExcludeMissing + private val primaryPhoneNumber: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun accounts(): Optional = + Optional.ofNullable(accounts.getNullable("accounts")) + + fun departments(): Optional = + Optional.ofNullable(departments.getNullable("departments")) + + fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + + fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun legalName(): Optional = Optional.ofNullable(legalName.getNullable("legal_name")) - fun entity(): Optional = Optional.ofNullable(entity.getNullable("entity")) + fun locations(): Optional = + Optional.ofNullable(locations.getNullable("locations")) fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail.getNullable("primary_email")) @@ -639,22 +678,19 @@ private constructor( fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber.getNullable("primary_phone_number")) - fun ein(): Optional = Optional.ofNullable(ein.getNullable("ein")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - fun accounts(): Optional = - Optional.ofNullable(accounts.getNullable("accounts")) + @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts - fun departments(): Optional = - Optional.ofNullable(departments.getNullable("departments")) + @JsonProperty("departments") @ExcludeMissing fun _departments() = departments - fun locations(): Optional = - Optional.ofNullable(locations.getNullable("locations")) + @JsonProperty("ein") @ExcludeMissing fun _ein() = ein - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("entity") @ExcludeMissing fun _entity() = entity @JsonProperty("legal_name") @ExcludeMissing fun _legalName() = legalName - @JsonProperty("entity") @ExcludeMissing fun _entity() = entity + @JsonProperty("locations") @ExcludeMissing fun _locations() = locations @JsonProperty("primary_email") @ExcludeMissing fun _primaryEmail() = primaryEmail @@ -662,29 +698,23 @@ private constructor( @ExcludeMissing fun _primaryPhoneNumber() = primaryPhoneNumber - @JsonProperty("ein") @ExcludeMissing fun _ein() = ein - - @JsonProperty("accounts") @ExcludeMissing fun _accounts() = accounts - - @JsonProperty("departments") @ExcludeMissing fun _departments() = departments - - @JsonProperty("locations") @ExcludeMissing fun _locations() = locations - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedCompanyFields = apply { if (!validated) { id() - legalName() - entity().map { it.validate() } - primaryEmail() - primaryPhoneNumber() - ein() accounts().map { it.validate() } departments().map { it.validate() } + ein() + entity().map { it.validate() } + legalName() locations().map { it.validate() } + primaryEmail() + primaryPhoneNumber() validated = true } } @@ -699,55 +729,69 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 ein: JsonField = JsonMissing.of() private var accounts: JsonField = JsonMissing.of() private var departments: JsonField = JsonMissing.of() + private var ein: JsonField = JsonMissing.of() + private var entity: JsonField = JsonMissing.of() + private var legalName: JsonField = JsonMissing.of() private var locations: JsonField = JsonMissing.of() + private var primaryEmail: JsonField = JsonMissing.of() + private var primaryPhoneNumber: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedCompanyFields: SupportedCompanyFields) = apply { - this.id = supportedCompanyFields.id - this.legalName = supportedCompanyFields.legalName - this.entity = supportedCompanyFields.entity - this.primaryEmail = supportedCompanyFields.primaryEmail - this.primaryPhoneNumber = supportedCompanyFields.primaryPhoneNumber - this.ein = supportedCompanyFields.ein - this.accounts = supportedCompanyFields.accounts - this.departments = supportedCompanyFields.departments - this.locations = supportedCompanyFields.locations - additionalProperties(supportedCompanyFields.additionalProperties) + id = supportedCompanyFields.id + accounts = supportedCompanyFields.accounts + departments = supportedCompanyFields.departments + ein = supportedCompanyFields.ein + entity = supportedCompanyFields.entity + legalName = supportedCompanyFields.legalName + locations = supportedCompanyFields.locations + primaryEmail = supportedCompanyFields.primaryEmail + primaryPhoneNumber = supportedCompanyFields.primaryPhoneNumber + additionalProperties = + supportedCompanyFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts)) + + fun accounts(accounts: JsonField) = apply { this.accounts = accounts } + + fun departments(departments: Departments) = + departments(JsonField.of(departments)) + + fun departments(departments: JsonField) = apply { + this.departments = departments + } + + fun ein(ein: Boolean) = ein(JsonField.of(ein)) + + fun ein(ein: JsonField) = apply { this.ein = ein } + + fun entity(entity: Entity) = entity(JsonField.of(entity)) + + fun entity(entity: JsonField) = apply { this.entity = entity } + fun legalName(legalName: Boolean) = legalName(JsonField.of(legalName)) - @JsonProperty("legal_name") - @ExcludeMissing fun legalName(legalName: JsonField) = apply { this.legalName = legalName } - fun entity(entity: Entity) = entity(JsonField.of(entity)) + fun locations(locations: Locations) = locations(JsonField.of(locations)) - @JsonProperty("entity") - @ExcludeMissing - fun entity(entity: JsonField) = apply { this.entity = entity } + fun locations(locations: JsonField) = apply { + this.locations = locations + } fun primaryEmail(primaryEmail: Boolean) = primaryEmail(JsonField.of(primaryEmail)) - @JsonProperty("primary_email") - @ExcludeMissing fun primaryEmail(primaryEmail: JsonField) = apply { this.primaryEmail = primaryEmail } @@ -755,49 +799,17 @@ private constructor( fun primaryPhoneNumber(primaryPhoneNumber: Boolean) = primaryPhoneNumber(JsonField.of(primaryPhoneNumber)) - @JsonProperty("primary_phone_number") - @ExcludeMissing fun primaryPhoneNumber(primaryPhoneNumber: JsonField) = apply { this.primaryPhoneNumber = primaryPhoneNumber } - fun ein(ein: Boolean) = ein(JsonField.of(ein)) - - @JsonProperty("ein") - @ExcludeMissing - fun ein(ein: JsonField) = apply { this.ein = ein } - - fun accounts(accounts: Accounts) = accounts(JsonField.of(accounts)) - - @JsonProperty("accounts") - @ExcludeMissing - fun accounts(accounts: JsonField) = apply { this.accounts = accounts } - - fun departments(departments: Departments) = - departments(JsonField.of(departments)) - - @JsonProperty("departments") - @ExcludeMissing - fun departments(departments: JsonField) = apply { - this.departments = departments - } - - fun locations(locations: Locations) = locations(JsonField.of(locations)) - - @JsonProperty("locations") - @ExcludeMissing - fun locations(locations: JsonField) = apply { - this.locations = locations - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -805,77 +817,96 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedCompanyFields = SupportedCompanyFields( id, - legalName, - entity, - primaryEmail, - primaryPhoneNumber, - ein, accounts, departments, + ein, + entity, + legalName, locations, + primaryEmail, + primaryPhoneNumber, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Accounts.Builder::class) @NoAutoDetect class Accounts + @JsonCreator 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, + @JsonProperty("account_name") + @ExcludeMissing + private val accountName: JsonField = JsonMissing.of(), + @JsonProperty("account_number") + @ExcludeMissing + private val accountNumber: JsonField = JsonMissing.of(), + @JsonProperty("account_type") + @ExcludeMissing + private val accountType: JsonField = JsonMissing.of(), + @JsonProperty("institution_name") + @ExcludeMissing + private val institutionName: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + private val routingNumber: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun routingNumber(): Optional = - Optional.ofNullable(routingNumber.getNullable("routing_number")) - fun accountName(): Optional = Optional.ofNullable(accountName.getNullable("account_name")) - fun institutionName(): Optional = - Optional.ofNullable(institutionName.getNullable("institution_name")) + fun accountNumber(): Optional = + Optional.ofNullable(accountNumber.getNullable("account_number")) fun accountType(): Optional = Optional.ofNullable(accountType.getNullable("account_type")) - fun accountNumber(): Optional = - Optional.ofNullable(accountNumber.getNullable("account_number")) + fun institutionName(): Optional = + Optional.ofNullable(institutionName.getNullable("institution_name")) - @JsonProperty("routing_number") - @ExcludeMissing - fun _routingNumber() = routingNumber + fun routingNumber(): Optional = + Optional.ofNullable(routingNumber.getNullable("routing_number")) @JsonProperty("account_name") @ExcludeMissing fun _accountName() = accountName - @JsonProperty("institution_name") + @JsonProperty("account_number") @ExcludeMissing - fun _institutionName() = institutionName + fun _accountNumber() = accountNumber @JsonProperty("account_type") @ExcludeMissing fun _accountType() = accountType - @JsonProperty("account_number") + @JsonProperty("institution_name") @ExcludeMissing - fun _accountNumber() = accountNumber + fun _institutionName() = institutionName + + @JsonProperty("routing_number") + @ExcludeMissing + fun _routingNumber() = routingNumber @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Accounts = apply { if (!validated) { - routingNumber() accountName() - institutionName() - accountType() accountNumber() + accountType() + institutionName() + routingNumber() validated = true } } @@ -889,91 +920,88 @@ private constructor( 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 accountType: JsonField = JsonMissing.of() + private var institutionName: JsonField = JsonMissing.of() + private var routingNumber: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accounts: Accounts) = apply { - this.routingNumber = accounts.routingNumber - this.accountName = accounts.accountName - this.institutionName = accounts.institutionName - this.accountType = accounts.accountType - this.accountNumber = accounts.accountNumber - additionalProperties(accounts.additionalProperties) - } - - fun routingNumber(routingNumber: Boolean) = - routingNumber(JsonField.of(routingNumber)) - - @JsonProperty("routing_number") - @ExcludeMissing - fun routingNumber(routingNumber: JsonField) = apply { - this.routingNumber = routingNumber + accountName = accounts.accountName + accountNumber = accounts.accountNumber + accountType = accounts.accountType + institutionName = accounts.institutionName + routingNumber = accounts.routingNumber + additionalProperties = accounts.additionalProperties.toMutableMap() } fun accountName(accountName: Boolean) = accountName(JsonField.of(accountName)) - @JsonProperty("account_name") - @ExcludeMissing fun accountName(accountName: JsonField) = apply { this.accountName = accountName } - fun institutionName(institutionName: Boolean) = - institutionName(JsonField.of(institutionName)) + fun accountNumber(accountNumber: Boolean) = + accountNumber(JsonField.of(accountNumber)) - @JsonProperty("institution_name") - @ExcludeMissing - fun institutionName(institutionName: JsonField) = apply { - this.institutionName = institutionName + fun accountNumber(accountNumber: JsonField) = apply { + this.accountNumber = accountNumber } fun accountType(accountType: Boolean) = accountType(JsonField.of(accountType)) - @JsonProperty("account_type") - @ExcludeMissing fun accountType(accountType: JsonField) = apply { this.accountType = accountType } - fun accountNumber(accountNumber: Boolean) = - accountNumber(JsonField.of(accountNumber)) + fun institutionName(institutionName: Boolean) = + institutionName(JsonField.of(institutionName)) - @JsonProperty("account_number") - @ExcludeMissing - fun accountNumber(accountNumber: JsonField) = apply { - this.accountNumber = accountNumber + fun institutionName(institutionName: JsonField) = apply { + this.institutionName = institutionName + } + + fun routingNumber(routingNumber: Boolean) = + routingNumber(JsonField.of(routingNumber)) + + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Accounts = Accounts( - routingNumber, accountName, - institutionName, - accountType, accountNumber, + accountType, + institutionName, + routingNumber, additionalProperties.toImmutable(), ) } @@ -983,30 +1011,33 @@ private constructor( return true } - return /* spotless:off */ other is Accounts && routingNumber == other.routingNumber && accountName == other.accountName && institutionName == other.institutionName && accountType == other.accountType && accountNumber == other.accountNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Accounts && accountName == other.accountName && accountNumber == other.accountNumber && accountType == other.accountType && institutionName == other.institutionName && routingNumber == other.routingNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(routingNumber, accountName, institutionName, accountType, accountNumber, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountName, accountNumber, accountType, institutionName, routingNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Accounts{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + "Accounts{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Departments.Builder::class) @NoAutoDetect class Departments + @JsonCreator private constructor( - private val name: JsonField, - private val parent: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("parent") + @ExcludeMissing + private val parent: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) fun parent(): Optional = @@ -1020,6 +1051,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Departments = apply { if (!validated) { name() @@ -1044,38 +1077,41 @@ private constructor( @JvmSynthetic internal fun from(departments: Departments) = apply { - this.name = departments.name - this.parent = departments.parent - additionalProperties(departments.additionalProperties) + name = departments.name + parent = departments.parent + additionalProperties = departments.additionalProperties.toMutableMap() } fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun parent(parent: Parent) = parent(JsonField.of(parent)) - @JsonProperty("parent") - @ExcludeMissing fun parent(parent: JsonField) = apply { this.parent = parent } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Departments = Departments( name, @@ -1084,16 +1120,18 @@ private constructor( ) } - @JsonDeserialize(builder = Parent.Builder::class) @NoAutoDetect class Parent + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @@ -1103,6 +1141,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Parent = apply { if (!validated) { name() @@ -1125,31 +1165,36 @@ private constructor( @JvmSynthetic internal fun from(parent: Parent) = apply { - this.name = parent.name - additionalProperties(parent.additionalProperties) + name = parent.name + additionalProperties = parent.additionalProperties.toMutableMap() } fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -1189,34 +1234,39 @@ private constructor( "Departments{name=$name, parent=$parent, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Entity.Builder::class) @NoAutoDetect class Entity + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Entity = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -1230,49 +1280,52 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = entity.subtype + type = entity.type + additionalProperties = entity.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) - @JsonProperty("subtype") - @ExcludeMissing fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Entity = Entity( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -1282,72 +1335,85 @@ private constructor( return true } - return /* spotless:off */ other is Entity && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Entity && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Locations.Builder::class) @NoAutoDetect class Locations + @JsonCreator private constructor( - private val line1: JsonField, - private val line2: JsonField, - private val city: JsonField, - private val state: JsonField, - private val postalCode: JsonField, - private val country: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + private val line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + private val state: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = + Optional.ofNullable(country.getNullable("country")) fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Locations = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -1361,87 +1427,82 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(locations: Locations) = apply { - this.line1 = locations.line1 - this.line2 = locations.line2 - this.city = locations.city - this.state = locations.state - this.postalCode = locations.postalCode - this.country = locations.country - additionalProperties(locations.additionalProperties) + city = locations.city + country = locations.country + line1 = locations.line1 + line2 = locations.line2 + postalCode = locations.postalCode + state = locations.state + additionalProperties = locations.additionalProperties.toMutableMap() } - fun line1(line1: Boolean) = line1(JsonField.of(line1)) + fun city(city: Boolean) = city(JsonField.of(city)) - @JsonProperty("line1") - @ExcludeMissing - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: Boolean) = line2(JsonField.of(line2)) + fun country(country: Boolean) = country(JsonField.of(country)) - @JsonProperty("line2") - @ExcludeMissing - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: Boolean) = city(JsonField.of(city)) + fun line1(line1: Boolean) = line1(JsonField.of(line1)) - @JsonProperty("city") - @ExcludeMissing - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: Boolean) = state(JsonField.of(state)) + fun line2(line2: Boolean) = line2(JsonField.of(line2)) - @JsonProperty("state") - @ExcludeMissing - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: Boolean) = country(JsonField.of(country)) + fun state(state: Boolean) = state(JsonField.of(state)) - @JsonProperty("country") - @ExcludeMissing - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Locations = Locations( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -1451,17 +1512,17 @@ private constructor( return true } - return /* spotless:off */ other is Locations && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Locations && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Locations{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "Locations{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1469,47 +1530,52 @@ private constructor( return true } - return /* spotless:off */ other is SupportedCompanyFields && id == other.id && legalName == other.legalName && entity == other.entity && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && ein == other.ein && accounts == other.accounts && departments == other.departments && locations == other.locations && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedCompanyFields && id == other.id && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, legalName, entity, primaryEmail, primaryPhoneNumber, ein, accounts, departments, locations, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedCompanyFields{id=$id, legalName=$legalName, entity=$entity, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, ein=$ein, accounts=$accounts, departments=$departments, locations=$locations, additionalProperties=$additionalProperties}" + "SupportedCompanyFields{id=$id, accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedDirectoryFields.Builder::class) @NoAutoDetect class SupportedDirectoryFields + @JsonCreator private constructor( - private val paging: JsonField, - private val individuals: JsonField, - private val additionalProperties: Map, + @JsonProperty("individuals") + @ExcludeMissing + private val individuals: JsonField = JsonMissing.of(), + @JsonProperty("paging") + @ExcludeMissing + private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) - fun individuals(): Optional = Optional.ofNullable(individuals.getNullable("individuals")) - @JsonProperty("paging") @ExcludeMissing fun _paging() = paging + fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) @JsonProperty("individuals") @ExcludeMissing fun _individuals() = individuals + @JsonProperty("paging") @ExcludeMissing fun _paging() = paging + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedDirectoryFields = apply { if (!validated) { - paging().map { it.validate() } individuals().map { it.validate() } + paging().map { it.validate() } validated = true } } @@ -1523,40 +1589,36 @@ private constructor( class Builder { - private var paging: JsonField = JsonMissing.of() private var individuals: JsonField = JsonMissing.of() + private var paging: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedDirectoryFields: SupportedDirectoryFields) = apply { - this.paging = supportedDirectoryFields.paging - this.individuals = supportedDirectoryFields.individuals - additionalProperties(supportedDirectoryFields.additionalProperties) + individuals = supportedDirectoryFields.individuals + paging = supportedDirectoryFields.paging + additionalProperties = + supportedDirectoryFields.additionalProperties.toMutableMap() } - fun paging(paging: Paging) = paging(JsonField.of(paging)) - - @JsonProperty("paging") - @ExcludeMissing - fun paging(paging: JsonField) = apply { this.paging = paging } - fun individuals(individuals: Individuals) = individuals(JsonField.of(individuals)) - @JsonProperty("individuals") - @ExcludeMissing fun individuals(individuals: JsonField) = apply { this.individuals = individuals } + fun paging(paging: Paging) = paging(JsonField.of(paging)) + + fun paging(paging: JsonField) = apply { this.paging = paging } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1564,77 +1626,100 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedDirectoryFields = SupportedDirectoryFields( - paging, individuals, + paging, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Individuals.Builder::class) @NoAutoDetect class Individuals + @JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val isActive: JsonField, - private val department: JsonField, - private val manager: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun department(): Optional = + Optional.ofNullable(department.getNullable("department")) + fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name")) - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) - - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) - fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active")) - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) + fun lastName(): Optional = + Optional.ofNullable(lastName.getNullable("last_name")) fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + @JsonProperty("department") @ExcludeMissing fun _department() = department - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - @JsonProperty("department") @ExcludeMissing fun _department() = department + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Individuals = apply { if (!validated) { id() + department() firstName() - middleName() - lastName() isActive() - department() + lastName() manager().map { it.validate() } + middleName() validated = true } } @@ -1649,117 +1734,112 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var department: JsonField = JsonMissing.of() private var firstName: JsonField = JsonMissing.of() - private var middleName: JsonField = JsonMissing.of() - private var lastName: JsonField = JsonMissing.of() private var isActive: JsonField = JsonMissing.of() - private var department: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individuals: Individuals) = apply { - this.id = individuals.id - this.firstName = individuals.firstName - this.middleName = individuals.middleName - this.lastName = individuals.lastName - this.isActive = individuals.isActive - this.department = individuals.department - this.manager = individuals.manager - additionalProperties(individuals.additionalProperties) + id = individuals.id + department = individuals.department + firstName = individuals.firstName + isActive = individuals.isActive + lastName = individuals.lastName + manager = individuals.manager + middleName = individuals.middleName + additionalProperties = individuals.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - - @JsonProperty("first_name") - @ExcludeMissing - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName - } - - fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + fun department(department: Boolean) = department(JsonField.of(department)) - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { - this.middleName = middleName + fun department(department: JsonField) = apply { + this.department = department } - fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { - this.lastName = lastName + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName } fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - @JsonProperty("is_active") - @ExcludeMissing fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - fun department(department: Boolean) = department(JsonField.of(department)) + fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) - @JsonProperty("department") - @ExcludeMissing - fun department(department: JsonField) = apply { - this.department = department + fun lastName(lastName: JsonField) = apply { + this.lastName = lastName } fun manager(manager: Manager) = manager(JsonField.of(manager)) - @JsonProperty("manager") - @ExcludeMissing fun manager(manager: JsonField) = apply { this.manager = manager } + fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + + fun middleName(middleName: JsonField) = apply { + this.middleName = middleName + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Individuals = Individuals( id, + department, firstName, - middleName, - lastName, isActive, - department, + lastName, manager, + middleName, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @JsonProperty("id") @ExcludeMissing fun _id() = id @@ -1768,6 +1848,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -1790,31 +1872,36 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -1841,30 +1928,33 @@ private constructor( return true } - return /* spotless:off */ other is Individuals && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && isActive == other.isActive && department == other.department && manager == other.manager && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Individuals && id == other.id && department == other.department && firstName == other.firstName && isActive == other.isActive && lastName == other.lastName && manager == other.manager && middleName == other.middleName && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, isActive, department, manager, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, department, firstName, isActive, lastName, manager, middleName, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Individuals{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, isActive=$isActive, department=$department, manager=$manager, additionalProperties=$additionalProperties}" + "Individuals{id=$id, department=$department, firstName=$firstName, isActive=$isActive, lastName=$lastName, manager=$manager, middleName=$middleName, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Paging.Builder::class) @NoAutoDetect class Paging + @JsonCreator private constructor( - private val count: JsonField, - private val offset: JsonField, - private val additionalProperties: Map, + @JsonProperty("count") + @ExcludeMissing + private val count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + private val offset: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun count(): Optional = Optional.ofNullable(count.getNullable("count")) fun offset(): Optional = @@ -1878,6 +1968,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Paging = apply { if (!validated) { count() @@ -1902,38 +1994,41 @@ private constructor( @JvmSynthetic internal fun from(paging: Paging) = apply { - this.count = paging.count - this.offset = paging.offset - additionalProperties(paging.additionalProperties) + count = paging.count + offset = paging.offset + additionalProperties = paging.additionalProperties.toMutableMap() } fun count(count: Boolean) = count(JsonField.of(count)) - @JsonProperty("count") - @ExcludeMissing fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) - @JsonProperty("offset") - @ExcludeMissing fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Paging = Paging( count, @@ -1965,86 +2060,111 @@ private constructor( return true } - return /* spotless:off */ other is SupportedDirectoryFields && paging == other.paging && individuals == other.individuals && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedDirectoryFields && individuals == other.individuals && paging == other.paging && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(paging, individuals, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(individuals, paging, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedDirectoryFields{paging=$paging, individuals=$individuals, additionalProperties=$additionalProperties}" + "SupportedDirectoryFields{individuals=$individuals, paging=$paging, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedEmploymentFields.Builder::class) @NoAutoDetect class SupportedEmploymentFields + @JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val title: JsonField, - private val startDate: JsonField, - private val endDate: JsonField, - private val isActive: JsonField, - private val employmentStatus: JsonField, - private val incomeHistory: JsonField, - private val classCode: JsonField, - private val customFields: JsonField, - private val department: JsonField, - private val employment: JsonField, - private val income: JsonField, - private val location: JsonField, - private val manager: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("class_code") + @ExcludeMissing + private val classCode: JsonField = JsonMissing.of(), + @JsonProperty("custom_fields") + @ExcludeMissing + private val customFields: JsonField = JsonMissing.of(), + @JsonProperty("department") + @ExcludeMissing + private val department: JsonField = JsonMissing.of(), + @JsonProperty("employment") + @ExcludeMissing + private val employment: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + private val employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("income") + @ExcludeMissing + private val income: JsonField = JsonMissing.of(), + @JsonProperty("income_history") + @ExcludeMissing + private val incomeHistory: JsonField = JsonMissing.of(), + @JsonProperty("is_active") + @ExcludeMissing + private val isActive: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("location") + @ExcludeMissing + private val location: JsonField = JsonMissing.of(), + @JsonProperty("manager") + @ExcludeMissing + private val manager: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonProperty("title") + @ExcludeMissing + private val title: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) + fun classCode(): Optional = + Optional.ofNullable(classCode.getNullable("class_code")) - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) + fun customFields(): Optional = + Optional.ofNullable(customFields.getNullable("custom_fields")) - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) + fun department(): Optional = + Optional.ofNullable(department.getNullable("department")) - fun title(): Optional = Optional.ofNullable(title.getNullable("title")) + fun employment(): Optional = + Optional.ofNullable(employment.getNullable("employment")) - fun startDate(): Optional = - Optional.ofNullable(startDate.getNullable("start_date")) + fun employmentStatus(): Optional = + Optional.ofNullable(employmentStatus.getNullable("employment_status")) fun endDate(): Optional = Optional.ofNullable(endDate.getNullable("end_date")) - fun isActive(): Optional = - Optional.ofNullable(isActive.getNullable("is_active")) + fun firstName(): Optional = + Optional.ofNullable(firstName.getNullable("first_name")) - fun employmentStatus(): Optional = - Optional.ofNullable(employmentStatus.getNullable("employment_status")) + fun income(): Optional = Optional.ofNullable(income.getNullable("income")) fun incomeHistory(): Optional = Optional.ofNullable(incomeHistory.getNullable("income_history")) - fun classCode(): Optional = - Optional.ofNullable(classCode.getNullable("class_code")) - - fun customFields(): Optional = - Optional.ofNullable(customFields.getNullable("custom_fields")) - - fun department(): Optional = - Optional.ofNullable(department.getNullable("department")) - - fun employment(): Optional = - Optional.ofNullable(employment.getNullable("employment")) + fun isActive(): Optional = + Optional.ofNullable(isActive.getNullable("is_active")) - fun income(): Optional = Optional.ofNullable(income.getNullable("income")) + fun lastName(): Optional = + Optional.ofNullable(lastName.getNullable("last_name")) fun location(): Optional = Optional.ofNullable(location.getNullable("location")) @@ -2052,65 +2172,75 @@ private constructor( fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + fun startDate(): Optional = + Optional.ofNullable(startDate.getNullable("start_date")) - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + fun title(): Optional = Optional.ofNullable(title.getNullable("title")) - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("title") @ExcludeMissing fun _title() = title + @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode - @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + @JsonProperty("custom_fields") @ExcludeMissing fun _customFields() = customFields - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate + @JsonProperty("department") @ExcludeMissing fun _department() = department - @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive + @JsonProperty("employment") @ExcludeMissing fun _employment() = employment @JsonProperty("employment_status") @ExcludeMissing fun _employmentStatus() = employmentStatus - @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory() = incomeHistory + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonProperty("class_code") @ExcludeMissing fun _classCode() = classCode + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName - @JsonProperty("custom_fields") @ExcludeMissing fun _customFields() = customFields + @JsonProperty("income") @ExcludeMissing fun _income() = income - @JsonProperty("department") @ExcludeMissing fun _department() = department + @JsonProperty("income_history") @ExcludeMissing fun _incomeHistory() = incomeHistory - @JsonProperty("employment") @ExcludeMissing fun _employment() = employment + @JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive - @JsonProperty("income") @ExcludeMissing fun _income() = income + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName @JsonProperty("location") @ExcludeMissing fun _location() = location @JsonProperty("manager") @ExcludeMissing fun _manager() = manager + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + + @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate + + @JsonProperty("title") @ExcludeMissing fun _title() = title + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedEmploymentFields = apply { if (!validated) { id() - firstName() - middleName() - lastName() - title() - startDate() - endDate() - isActive() - employmentStatus() - incomeHistory() classCode() customFields() department().map { it.validate() } employment().map { it.validate() } + employmentStatus() + endDate() + firstName() income().map { it.validate() } + incomeHistory() + isActive() + lastName() location().map { it.validate() } manager().map { it.validate() } + middleName() + startDate() + title() validated = true } } @@ -2125,123 +2255,54 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 startDate: JsonField = JsonMissing.of() - private var endDate: JsonField = JsonMissing.of() - private var isActive: JsonField = JsonMissing.of() - private var employmentStatus: JsonField = JsonMissing.of() - private var incomeHistory: JsonField = JsonMissing.of() private var classCode: JsonField = JsonMissing.of() private var customFields: JsonField = JsonMissing.of() private var department: JsonField = JsonMissing.of() private var employment: JsonField = JsonMissing.of() + private var employmentStatus: JsonField = JsonMissing.of() + private var endDate: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() private var income: JsonField = JsonMissing.of() - private var location: JsonField = JsonMissing.of() - private var manager: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(supportedEmploymentFields: SupportedEmploymentFields) = - apply { - this.id = supportedEmploymentFields.id - this.firstName = supportedEmploymentFields.firstName - this.middleName = supportedEmploymentFields.middleName - this.lastName = supportedEmploymentFields.lastName - this.title = supportedEmploymentFields.title - this.startDate = supportedEmploymentFields.startDate - this.endDate = supportedEmploymentFields.endDate - this.isActive = supportedEmploymentFields.isActive - this.employmentStatus = supportedEmploymentFields.employmentStatus - this.incomeHistory = supportedEmploymentFields.incomeHistory - this.classCode = supportedEmploymentFields.classCode - this.customFields = supportedEmploymentFields.customFields - this.department = supportedEmploymentFields.department - this.employment = supportedEmploymentFields.employment - this.income = supportedEmploymentFields.income - this.location = supportedEmploymentFields.location - this.manager = supportedEmploymentFields.manager - additionalProperties(supportedEmploymentFields.additionalProperties) - } - - fun id(id: Boolean) = id(JsonField.of(id)) - - @JsonProperty("id") - @ExcludeMissing - fun id(id: JsonField) = apply { this.id = id } - - fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - - @JsonProperty("first_name") - @ExcludeMissing - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName - } - - fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) - - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { - this.middleName = middleName - } - - fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) - - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - - fun title(title: Boolean) = title(JsonField.of(title)) - - @JsonProperty("title") - @ExcludeMissing - fun title(title: JsonField) = apply { this.title = title } - - fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) - - @JsonProperty("start_date") - @ExcludeMissing - fun startDate(startDate: JsonField) = apply { - this.startDate = startDate - } - - fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) - - @JsonProperty("end_date") - @ExcludeMissing - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - - @JsonProperty("is_active") - @ExcludeMissing - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - fun employmentStatus(employmentStatus: Boolean) = - employmentStatus(JsonField.of(employmentStatus)) + private var incomeHistory: JsonField = JsonMissing.of() + private var isActive: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var location: JsonField = JsonMissing.of() + private var manager: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() + private var title: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JsonProperty("employment_status") - @ExcludeMissing - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } + @JvmSynthetic + internal fun from(supportedEmploymentFields: SupportedEmploymentFields) = + apply { + id = supportedEmploymentFields.id + classCode = supportedEmploymentFields.classCode + customFields = supportedEmploymentFields.customFields + department = supportedEmploymentFields.department + employment = supportedEmploymentFields.employment + employmentStatus = supportedEmploymentFields.employmentStatus + endDate = supportedEmploymentFields.endDate + firstName = supportedEmploymentFields.firstName + income = supportedEmploymentFields.income + incomeHistory = supportedEmploymentFields.incomeHistory + isActive = supportedEmploymentFields.isActive + lastName = supportedEmploymentFields.lastName + location = supportedEmploymentFields.location + manager = supportedEmploymentFields.manager + middleName = supportedEmploymentFields.middleName + startDate = supportedEmploymentFields.startDate + title = supportedEmploymentFields.title + additionalProperties = + supportedEmploymentFields.additionalProperties.toMutableMap() + } - fun incomeHistory(incomeHistory: Boolean) = - incomeHistory(JsonField.of(incomeHistory)) + fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("income_history") - @ExcludeMissing - fun incomeHistory(incomeHistory: JsonField) = apply { - this.incomeHistory = incomeHistory - } + fun id(id: JsonField) = apply { this.id = id } fun classCode(classCode: Boolean) = classCode(JsonField.of(classCode)) - @JsonProperty("class_code") - @ExcludeMissing fun classCode(classCode: JsonField) = apply { this.classCode = classCode } @@ -2249,54 +2310,89 @@ private constructor( fun customFields(customFields: Boolean) = customFields(JsonField.of(customFields)) - @JsonProperty("custom_fields") - @ExcludeMissing fun customFields(customFields: JsonField) = apply { this.customFields = customFields } fun department(department: Department) = department(JsonField.of(department)) - @JsonProperty("department") - @ExcludeMissing fun department(department: JsonField) = apply { this.department = department } fun employment(employment: Employment) = employment(JsonField.of(employment)) - @JsonProperty("employment") - @ExcludeMissing fun employment(employment: JsonField) = apply { this.employment = employment } + fun employmentStatus(employmentStatus: Boolean) = + employmentStatus(JsonField.of(employmentStatus)) + + fun employmentStatus(employmentStatus: JsonField) = apply { + this.employmentStatus = employmentStatus + } + + fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName + } + fun income(income: Income) = income(JsonField.of(income)) - @JsonProperty("income") - @ExcludeMissing fun income(income: JsonField) = apply { this.income = income } + fun incomeHistory(incomeHistory: Boolean) = + incomeHistory(JsonField.of(incomeHistory)) + + fun incomeHistory(incomeHistory: JsonField) = apply { + this.incomeHistory = incomeHistory + } + + fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) + + fun isActive(isActive: JsonField) = apply { this.isActive = isActive } + + fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + fun location(location: Location) = location(JsonField.of(location)) - @JsonProperty("location") - @ExcludeMissing fun location(location: JsonField) = apply { this.location = location } fun manager(manager: Manager) = manager(JsonField.of(manager)) - @JsonProperty("manager") - @ExcludeMissing fun manager(manager: JsonField) = apply { this.manager = manager } + fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + + fun middleName(middleName: JsonField) = apply { + this.middleName = middleName + } + + fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) + + fun startDate(startDate: JsonField) = apply { + this.startDate = startDate + } + + fun title(title: Boolean) = title(JsonField.of(title)) + + fun title(title: JsonField) = apply { this.title = title } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -2304,39 +2400,48 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedEmploymentFields = SupportedEmploymentFields( id, - firstName, - middleName, - lastName, - title, - startDate, - endDate, - isActive, - employmentStatus, - incomeHistory, classCode, customFields, department, employment, + employmentStatus, + endDate, + firstName, income, + incomeHistory, + isActive, + lastName, location, manager, + middleName, + startDate, + title, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: JsonField, - private val additionalProperties: Map, + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) @JsonProperty("name") @ExcludeMissing fun _name() = name @@ -2345,6 +2450,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Department = apply { if (!validated) { name() @@ -2367,31 +2474,36 @@ private constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = department.additionalProperties.toMutableMap() } fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -2414,34 +2526,39 @@ private constructor( "Department{name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Employment.Builder::class) @NoAutoDetect class Employment + @JsonCreator private constructor( - private val type: JsonField, - private val subtype: JsonField, - private val additionalProperties: Map, + @JsonProperty("subtype") + @ExcludeMissing + private val subtype: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun subtype(): Optional = Optional.ofNullable(subtype.getNullable("subtype")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Employment = apply { if (!validated) { - type() subtype() + type() validated = true } } @@ -2455,49 +2572,52 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var subtype: JsonField = JsonMissing.of() + private var type: 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) + subtype = employment.subtype + type = employment.type + additionalProperties = employment.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - fun subtype(subtype: Boolean) = subtype(JsonField.of(subtype)) - @JsonProperty("subtype") - @ExcludeMissing fun subtype(subtype: JsonField) = apply { this.subtype = subtype } + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Employment = Employment( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -2507,31 +2627,36 @@ private constructor( return true } - return /* spotless:off */ other is Employment && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Employment && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Income.Builder::class) @NoAutoDetect class Income + @JsonCreator private constructor( - private val amount: JsonField, - private val currency: JsonField, - private val unit: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("unit") + @ExcludeMissing + private val unit: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) @@ -2550,6 +2675,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Income = apply { if (!validated) { amount() @@ -2576,47 +2703,48 @@ private constructor( @JvmSynthetic internal fun from(income: Income) = apply { - this.amount = income.amount - this.currency = income.currency - this.unit = income.unit - additionalProperties(income.additionalProperties) + amount = income.amount + currency = income.currency + unit = income.unit + additionalProperties = income.additionalProperties.toMutableMap() } fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } fun unit(unit: Boolean) = unit(JsonField.of(unit)) - @JsonProperty("unit") - @ExcludeMissing fun unit(unit: JsonField) = apply { this.unit = unit } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Income = Income( amount, @@ -2644,59 +2772,72 @@ private constructor( "Income{amount=$amount, currency=$currency, unit=$unit, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Location.Builder::class) @NoAutoDetect class Location + @JsonCreator private constructor( - private val line1: JsonField, - private val line2: JsonField, - private val city: JsonField, - private val state: JsonField, - private val postalCode: JsonField, - private val country: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + private val line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + private val state: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + + fun country(): Optional = + Optional.ofNullable(country.getNullable("country")) fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1")) fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2")) - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) + fun postalCode(): Optional = + Optional.ofNullable(postalCode.getNullable("postal_code")) fun state(): Optional = Optional.ofNullable(state.getNullable("state")) - fun postalCode(): Optional = - Optional.ofNullable(postalCode.getNullable("postal_code")) + @JsonProperty("city") @ExcludeMissing fun _city() = city - fun country(): Optional = - Optional.ofNullable(country.getNullable("country")) + @JsonProperty("country") @ExcludeMissing fun _country() = country @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 - @JsonProperty("city") @ExcludeMissing fun _city() = city - - @JsonProperty("state") @ExcludeMissing fun _state() = state - @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode - @JsonProperty("country") @ExcludeMissing fun _country() = country + @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Location = apply { if (!validated) { + city() + country() line1() line2() - city() - state() postalCode() - country() + state() validated = true } } @@ -2710,87 +2851,82 @@ private constructor( class Builder { + private var city: JsonField = JsonMissing.of() + private var country: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() - private var city: JsonField = JsonMissing.of() - private var state: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() - private var country: JsonField = JsonMissing.of() + private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(location: Location) = apply { - this.line1 = location.line1 - this.line2 = location.line2 - this.city = location.city - this.state = location.state - this.postalCode = location.postalCode - this.country = location.country - additionalProperties(location.additionalProperties) + city = location.city + country = location.country + line1 = location.line1 + line2 = location.line2 + postalCode = location.postalCode + state = location.state + additionalProperties = location.additionalProperties.toMutableMap() } - fun line1(line1: Boolean) = line1(JsonField.of(line1)) + fun city(city: Boolean) = city(JsonField.of(city)) - @JsonProperty("line1") - @ExcludeMissing - fun line1(line1: JsonField) = apply { this.line1 = line1 } + fun city(city: JsonField) = apply { this.city = city } - fun line2(line2: Boolean) = line2(JsonField.of(line2)) + fun country(country: Boolean) = country(JsonField.of(country)) - @JsonProperty("line2") - @ExcludeMissing - fun line2(line2: JsonField) = apply { this.line2 = line2 } + fun country(country: JsonField) = apply { this.country = country } - fun city(city: Boolean) = city(JsonField.of(city)) + fun line1(line1: Boolean) = line1(JsonField.of(line1)) - @JsonProperty("city") - @ExcludeMissing - fun city(city: JsonField) = apply { this.city = city } + fun line1(line1: JsonField) = apply { this.line1 = line1 } - fun state(state: Boolean) = state(JsonField.of(state)) + fun line2(line2: Boolean) = line2(JsonField.of(line2)) - @JsonProperty("state") - @ExcludeMissing - fun state(state: JsonField) = apply { this.state = state } + fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } - fun country(country: Boolean) = country(JsonField.of(country)) + fun state(state: Boolean) = state(JsonField.of(state)) - @JsonProperty("country") - @ExcludeMissing - fun country(country: JsonField) = apply { this.country = country } + fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Location = Location( + city, + country, line1, line2, - city, - state, postalCode, - country, + state, additionalProperties.toImmutable(), ) } @@ -2800,28 +2936,29 @@ private constructor( return true } - return /* spotless:off */ other is Location && line1 == other.line1 && line2 == other.line2 && city == other.city && state == other.state && postalCode == other.postalCode && country == other.country && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Location && city == other.city && country == other.country && line1 == other.line1 && line2 == other.line2 && postalCode == other.postalCode && state == other.state && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(line1, line2, city, state, postalCode, country, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(city, country, line1, line2, postalCode, state, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Location{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}" + "Location{city=$city, country=$country, line1=$line1, line2=$line2, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: JsonField, - private val additionalProperties: Map, - ) { - - private var validated: Boolean = false + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { fun id(): Optional = Optional.ofNullable(id.getNullable("id")) @@ -2831,6 +2968,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Manager = apply { if (!validated) { id() @@ -2853,31 +2992,36 @@ private constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -2904,120 +3048,147 @@ private constructor( return true } - return /* spotless:off */ other is SupportedEmploymentFields && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && title == other.title && startDate == other.startDate && endDate == other.endDate && isActive == other.isActive && employmentStatus == other.employmentStatus && incomeHistory == other.incomeHistory && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && income == other.income && location == other.location && manager == other.manager && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedEmploymentFields && id == other.id && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && location == other.location && manager == other.manager && middleName == other.middleName && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, title, startDate, endDate, isActive, employmentStatus, incomeHistory, classCode, customFields, department, employment, income, location, manager, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, location, manager, middleName, startDate, title, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedEmploymentFields{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, title=$title, startDate=$startDate, endDate=$endDate, isActive=$isActive, employmentStatus=$employmentStatus, incomeHistory=$incomeHistory, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, income=$income, location=$location, manager=$manager, additionalProperties=$additionalProperties}" + "SupportedEmploymentFields{id=$id, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, location=$location, manager=$manager, middleName=$middleName, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedIndividualFields.Builder::class) @NoAutoDetect class SupportedIndividualFields + @JsonCreator private constructor( - private val id: JsonField, - private val firstName: JsonField, - private val middleName: JsonField, - private val lastName: JsonField, - private val preferredName: JsonField, - private val dob: JsonField, - private val gender: JsonField, - private val ethnicity: JsonField, - private val ssn: JsonField, - private val encryptedSsn: JsonField, - private val emails: JsonField, - private val phoneNumbers: JsonField, - private val residence: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("dob") + @ExcludeMissing + private val dob: JsonField = JsonMissing.of(), + @JsonProperty("emails") + @ExcludeMissing + private val emails: JsonField = JsonMissing.of(), + @JsonProperty("encrypted_ssn") + @ExcludeMissing + private val encryptedSsn: JsonField = JsonMissing.of(), + @JsonProperty("ethnicity") + @ExcludeMissing + private val ethnicity: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + private val firstName: JsonField = JsonMissing.of(), + @JsonProperty("gender") + @ExcludeMissing + private val gender: JsonField = JsonMissing.of(), + @JsonProperty("last_name") + @ExcludeMissing + private val lastName: JsonField = JsonMissing.of(), + @JsonProperty("middle_name") + @ExcludeMissing + private val middleName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + private val phoneNumbers: JsonField = JsonMissing.of(), + @JsonProperty("preferred_name") + @ExcludeMissing + private val preferredName: JsonField = JsonMissing.of(), + @JsonProperty("residence") + @ExcludeMissing + private val residence: JsonField = JsonMissing.of(), + @JsonProperty("ssn") + @ExcludeMissing + private val ssn: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun firstName(): Optional = - Optional.ofNullable(firstName.getNullable("first_name")) - - fun middleName(): Optional = - Optional.ofNullable(middleName.getNullable("middle_name")) - - fun lastName(): Optional = - Optional.ofNullable(lastName.getNullable("last_name")) - - fun preferredName(): Optional = - Optional.ofNullable(preferredName.getNullable("preferred_name")) - fun dob(): Optional = Optional.ofNullable(dob.getNullable("dob")) - fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) + fun emails(): Optional = Optional.ofNullable(emails.getNullable("emails")) + + fun encryptedSsn(): Optional = + Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) fun ethnicity(): Optional = Optional.ofNullable(ethnicity.getNullable("ethnicity")) - fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + fun firstName(): Optional = + Optional.ofNullable(firstName.getNullable("first_name")) - fun encryptedSsn(): Optional = - Optional.ofNullable(encryptedSsn.getNullable("encrypted_ssn")) + fun gender(): Optional = Optional.ofNullable(gender.getNullable("gender")) - fun emails(): Optional = Optional.ofNullable(emails.getNullable("emails")) + fun lastName(): Optional = + Optional.ofNullable(lastName.getNullable("last_name")) + + fun middleName(): Optional = + Optional.ofNullable(middleName.getNullable("middle_name")) fun phoneNumbers(): Optional = Optional.ofNullable(phoneNumbers.getNullable("phone_numbers")) + fun preferredName(): Optional = + Optional.ofNullable(preferredName.getNullable("preferred_name")) + fun residence(): Optional = Optional.ofNullable(residence.getNullable("residence")) + fun ssn(): Optional = Optional.ofNullable(ssn.getNullable("ssn")) + @JsonProperty("id") @ExcludeMissing fun _id() = id - @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName + @JsonProperty("dob") @ExcludeMissing fun _dob() = dob - @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName + @JsonProperty("emails") @ExcludeMissing fun _emails() = emails - @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName + @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn() = encryptedSsn - @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName() = preferredName + @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity() = ethnicity - @JsonProperty("dob") @ExcludeMissing fun _dob() = dob + @JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName @JsonProperty("gender") @ExcludeMissing fun _gender() = gender - @JsonProperty("ethnicity") @ExcludeMissing fun _ethnicity() = ethnicity - - @JsonProperty("ssn") @ExcludeMissing fun _ssn() = ssn - - @JsonProperty("encrypted_ssn") @ExcludeMissing fun _encryptedSsn() = encryptedSsn + @JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName - @JsonProperty("emails") @ExcludeMissing fun _emails() = emails + @JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName @JsonProperty("phone_numbers") @ExcludeMissing fun _phoneNumbers() = phoneNumbers + @JsonProperty("preferred_name") @ExcludeMissing fun _preferredName() = preferredName + @JsonProperty("residence") @ExcludeMissing fun _residence() = residence + @JsonProperty("ssn") @ExcludeMissing fun _ssn() = ssn + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedIndividualFields = apply { if (!validated) { id() - firstName() - middleName() - lastName() - preferredName() dob() - gender() - ethnicity() - ssn() - encryptedSsn() emails().map { it.validate() } + encryptedSsn() + ethnicity() + firstName() + gender() + lastName() + middleName() phoneNumbers().map { it.validate() } + preferredName() residence().map { it.validate() } + ssn() validated = true } } @@ -3032,142 +3203,116 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - 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 dob: JsonField = JsonMissing.of() - private var gender: JsonField = JsonMissing.of() - private var ethnicity: JsonField = JsonMissing.of() - private var ssn: JsonField = JsonMissing.of() - private var encryptedSsn: JsonField = JsonMissing.of() private var emails: JsonField = JsonMissing.of() + private var encryptedSsn: JsonField = JsonMissing.of() + private var ethnicity: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() + private var gender: JsonField = JsonMissing.of() + private var lastName: JsonField = JsonMissing.of() + private var middleName: JsonField = JsonMissing.of() private var phoneNumbers: JsonField = JsonMissing.of() + private var preferredName: JsonField = JsonMissing.of() private var residence: JsonField = JsonMissing.of() + private var ssn: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedIndividualFields: SupportedIndividualFields) = apply { - this.id = supportedIndividualFields.id - this.firstName = supportedIndividualFields.firstName - this.middleName = supportedIndividualFields.middleName - this.lastName = supportedIndividualFields.lastName - this.preferredName = supportedIndividualFields.preferredName - this.dob = supportedIndividualFields.dob - this.gender = supportedIndividualFields.gender - this.ethnicity = supportedIndividualFields.ethnicity - this.ssn = supportedIndividualFields.ssn - this.encryptedSsn = supportedIndividualFields.encryptedSsn - this.emails = supportedIndividualFields.emails - this.phoneNumbers = supportedIndividualFields.phoneNumbers - this.residence = supportedIndividualFields.residence - additionalProperties(supportedIndividualFields.additionalProperties) + id = supportedIndividualFields.id + dob = supportedIndividualFields.dob + emails = supportedIndividualFields.emails + encryptedSsn = supportedIndividualFields.encryptedSsn + ethnicity = supportedIndividualFields.ethnicity + firstName = supportedIndividualFields.firstName + gender = supportedIndividualFields.gender + lastName = supportedIndividualFields.lastName + middleName = supportedIndividualFields.middleName + phoneNumbers = supportedIndividualFields.phoneNumbers + preferredName = supportedIndividualFields.preferredName + residence = supportedIndividualFields.residence + ssn = supportedIndividualFields.ssn + additionalProperties = + supportedIndividualFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) + fun dob(dob: Boolean) = dob(JsonField.of(dob)) - @JsonProperty("first_name") - @ExcludeMissing - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName - } + fun dob(dob: JsonField) = apply { this.dob = dob } - fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) + fun emails(emails: Emails) = emails(JsonField.of(emails)) - @JsonProperty("middle_name") - @ExcludeMissing - fun middleName(middleName: JsonField) = apply { - this.middleName = middleName - } + fun emails(emails: JsonField) = apply { this.emails = emails } - fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) + fun encryptedSsn(encryptedSsn: Boolean) = + encryptedSsn(JsonField.of(encryptedSsn)) - @JsonProperty("last_name") - @ExcludeMissing - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + fun encryptedSsn(encryptedSsn: JsonField) = apply { + this.encryptedSsn = encryptedSsn + } - fun preferredName(preferredName: Boolean) = - preferredName(JsonField.of(preferredName)) + fun ethnicity(ethnicity: Boolean) = ethnicity(JsonField.of(ethnicity)) - @JsonProperty("preferred_name") - @ExcludeMissing - fun preferredName(preferredName: JsonField) = apply { - this.preferredName = preferredName + fun ethnicity(ethnicity: JsonField) = apply { + this.ethnicity = ethnicity } - fun dob(dob: Boolean) = dob(JsonField.of(dob)) + fun firstName(firstName: Boolean) = firstName(JsonField.of(firstName)) - @JsonProperty("dob") - @ExcludeMissing - fun dob(dob: JsonField) = apply { this.dob = dob } + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName + } fun gender(gender: Boolean) = gender(JsonField.of(gender)) - @JsonProperty("gender") - @ExcludeMissing fun gender(gender: JsonField) = apply { this.gender = gender } - fun ethnicity(ethnicity: Boolean) = ethnicity(JsonField.of(ethnicity)) - - @JsonProperty("ethnicity") - @ExcludeMissing - fun ethnicity(ethnicity: JsonField) = apply { - this.ethnicity = ethnicity - } - - fun ssn(ssn: Boolean) = ssn(JsonField.of(ssn)) + fun lastName(lastName: Boolean) = lastName(JsonField.of(lastName)) - @JsonProperty("ssn") - @ExcludeMissing - fun ssn(ssn: JsonField) = apply { this.ssn = ssn } + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - fun encryptedSsn(encryptedSsn: Boolean) = - encryptedSsn(JsonField.of(encryptedSsn)) + fun middleName(middleName: Boolean) = middleName(JsonField.of(middleName)) - @JsonProperty("encrypted_ssn") - @ExcludeMissing - fun encryptedSsn(encryptedSsn: JsonField) = apply { - this.encryptedSsn = encryptedSsn + fun middleName(middleName: JsonField) = apply { + this.middleName = middleName } - fun emails(emails: Emails) = emails(JsonField.of(emails)) - - @JsonProperty("emails") - @ExcludeMissing - fun emails(emails: JsonField) = apply { this.emails = emails } - fun phoneNumbers(phoneNumbers: PhoneNumbers) = phoneNumbers(JsonField.of(phoneNumbers)) - @JsonProperty("phone_numbers") - @ExcludeMissing fun phoneNumbers(phoneNumbers: JsonField) = apply { this.phoneNumbers = phoneNumbers } + fun preferredName(preferredName: Boolean) = + preferredName(JsonField.of(preferredName)) + + fun preferredName(preferredName: JsonField) = apply { + this.preferredName = preferredName + } + fun residence(residence: Residence) = residence(JsonField.of(residence)) - @JsonProperty("residence") - @ExcludeMissing fun residence(residence: JsonField) = apply { this.residence = residence } + fun ssn(ssn: Boolean) = ssn(JsonField.of(ssn)) + + fun ssn(ssn: JsonField) = apply { this.ssn = ssn } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -3175,36 +3320,47 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedIndividualFields = SupportedIndividualFields( id, - firstName, - middleName, - lastName, - preferredName, dob, - gender, - ethnicity, - ssn, - encryptedSsn, emails, + encryptedSsn, + ethnicity, + firstName, + gender, + lastName, + middleName, phoneNumbers, + preferredName, residence, + ssn, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Emails.Builder::class) @NoAutoDetect class Emails + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @@ -3217,6 +3373,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Emails = apply { if (!validated) { data() @@ -3241,38 +3399,41 @@ private constructor( @JvmSynthetic internal fun from(emails: Emails) = apply { - this.data = emails.data - this.type = emails.type - additionalProperties(emails.additionalProperties) + data = emails.data + type = emails.type + additionalProperties = emails.additionalProperties.toMutableMap() } fun data(data: Boolean) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Emails = Emails( data, @@ -3299,17 +3460,20 @@ private constructor( "Emails{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PhoneNumbers.Builder::class) @NoAutoDetect class PhoneNumbers + @JsonCreator private constructor( - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @@ -3322,6 +3486,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PhoneNumbers = apply { if (!validated) { data() @@ -3346,38 +3512,41 @@ private constructor( @JvmSynthetic internal fun from(phoneNumbers: PhoneNumbers) = apply { - this.data = phoneNumbers.data - this.type = phoneNumbers.type - additionalProperties(phoneNumbers.additionalProperties) + data = phoneNumbers.data + type = phoneNumbers.type + additionalProperties = phoneNumbers.additionalProperties.toMutableMap() } fun data(data: Boolean) = data(JsonField.of(data)) - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } fun type(type: Boolean) = 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) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PhoneNumbers = PhoneNumbers( data, @@ -3404,21 +3573,32 @@ private constructor( "PhoneNumbers{data=$data, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Residence.Builder::class) @NoAutoDetect class Residence + @JsonCreator private constructor( - private val city: JsonField, - private val country: JsonField, - private val line1: JsonField, - private val line2: JsonField, - private val postalCode: JsonField, - private val state: JsonField, - private val additionalProperties: Map, + @JsonProperty("city") + @ExcludeMissing + private val city: JsonField = JsonMissing.of(), + @JsonProperty("country") + @ExcludeMissing + private val country: JsonField = JsonMissing.of(), + @JsonProperty("line1") + @ExcludeMissing + private val line1: JsonField = JsonMissing.of(), + @JsonProperty("line2") + @ExcludeMissing + private val line2: JsonField = JsonMissing.of(), + @JsonProperty("postal_code") + @ExcludeMissing + private val postalCode: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + private val state: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun city(): Optional = Optional.ofNullable(city.getNullable("city")) fun country(): Optional = @@ -3449,6 +3629,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Residence = apply { if (!validated) { city() @@ -3481,68 +3663,63 @@ private constructor( @JvmSynthetic internal fun from(residence: Residence) = apply { - this.city = residence.city - this.country = residence.country - this.line1 = residence.line1 - this.line2 = residence.line2 - this.postalCode = residence.postalCode - this.state = residence.state - additionalProperties(residence.additionalProperties) + city = residence.city + country = residence.country + line1 = residence.line1 + line2 = residence.line2 + postalCode = residence.postalCode + state = residence.state + additionalProperties = residence.additionalProperties.toMutableMap() } fun city(city: Boolean) = city(JsonField.of(city)) - @JsonProperty("city") - @ExcludeMissing fun city(city: JsonField) = apply { this.city = city } fun country(country: Boolean) = country(JsonField.of(country)) - @JsonProperty("country") - @ExcludeMissing fun country(country: JsonField) = apply { this.country = country } fun line1(line1: Boolean) = line1(JsonField.of(line1)) - @JsonProperty("line1") - @ExcludeMissing fun line1(line1: JsonField) = apply { this.line1 = line1 } fun line2(line2: Boolean) = line2(JsonField.of(line2)) - @JsonProperty("line2") - @ExcludeMissing fun line2(line2: JsonField) = apply { this.line2 = line2 } fun postalCode(postalCode: Boolean) = postalCode(JsonField.of(postalCode)) - @JsonProperty("postal_code") - @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } fun state(state: Boolean) = state(JsonField.of(state)) - @JsonProperty("state") - @ExcludeMissing fun state(state: JsonField) = apply { this.state = state } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Residence = Residence( city, @@ -3578,62 +3755,71 @@ private constructor( return true } - return /* spotless:off */ other is SupportedIndividualFields && id == other.id && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && preferredName == other.preferredName && dob == other.dob && gender == other.gender && ethnicity == other.ethnicity && ssn == other.ssn && encryptedSsn == other.encryptedSsn && emails == other.emails && phoneNumbers == other.phoneNumbers && residence == other.residence && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedIndividualFields && id == other.id && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, firstName, middleName, lastName, preferredName, dob, gender, ethnicity, ssn, encryptedSsn, emails, phoneNumbers, residence, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedIndividualFields{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, preferredName=$preferredName, dob=$dob, gender=$gender, ethnicity=$ethnicity, ssn=$ssn, encryptedSsn=$encryptedSsn, emails=$emails, phoneNumbers=$phoneNumbers, residence=$residence, additionalProperties=$additionalProperties}" + "SupportedIndividualFields{id=$id, dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedPayGroupFields.Builder::class) @NoAutoDetect class SupportedPayGroupFields + @JsonCreator private constructor( - private val id: JsonField, - private val name: JsonField, - private val payFrequencies: JsonField, - private val individualIds: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + fun individualIds(): Optional = + Optional.ofNullable(individualIds.getNullable("individual_ids")) + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - fun individualIds(): Optional = - Optional.ofNullable(individualIds.getNullable("individual_ids")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds + @JsonProperty("name") @ExcludeMissing fun _name() = name @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies - @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedPayGroupFields = apply { if (!validated) { id() + individualIds() name() payFrequencies() - individualIds() validated = true } } @@ -3648,58 +3834,50 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() + private var individualIds: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var payFrequencies: JsonField = JsonMissing.of() - private var individualIds: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedPayGroupFields: SupportedPayGroupFields) = apply { - this.id = supportedPayGroupFields.id - this.name = supportedPayGroupFields.name - this.payFrequencies = supportedPayGroupFields.payFrequencies - this.individualIds = supportedPayGroupFields.individualIds - additionalProperties(supportedPayGroupFields.additionalProperties) + id = supportedPayGroupFields.id + individualIds = supportedPayGroupFields.individualIds + name = supportedPayGroupFields.name + payFrequencies = supportedPayGroupFields.payFrequencies + additionalProperties = + supportedPayGroupFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } + fun individualIds(individualIds: Boolean) = + individualIds(JsonField.of(individualIds)) + + fun individualIds(individualIds: JsonField) = apply { + this.individualIds = individualIds + } + fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("name") - @ExcludeMissing fun name(name: JsonField) = apply { this.name = name } fun payFrequencies(payFrequencies: Boolean) = payFrequencies(JsonField.of(payFrequencies)) - @JsonProperty("pay_frequencies") - @ExcludeMissing fun payFrequencies(payFrequencies: JsonField) = apply { this.payFrequencies = payFrequencies } - fun individualIds(individualIds: Boolean) = - individualIds(JsonField.of(individualIds)) - - @JsonProperty("individual_ids") - @ExcludeMissing - fun individualIds(individualIds: JsonField) = apply { - this.individualIds = individualIds - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -3707,12 +3885,20 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedPayGroupFields = SupportedPayGroupFields( id, + individualIds, name, payFrequencies, - individualIds, additionalProperties.toImmutable(), ) } @@ -3722,30 +3908,33 @@ private constructor( return true } - return /* spotless:off */ other is SupportedPayGroupFields && id == other.id && name == other.name && payFrequencies == other.payFrequencies && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedPayGroupFields && id == other.id && individualIds == other.individualIds && name == other.name && payFrequencies == other.payFrequencies && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, name, payFrequencies, individualIds, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, individualIds, name, payFrequencies, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedPayGroupFields{id=$id, name=$name, payFrequencies=$payFrequencies, individualIds=$individualIds, additionalProperties=$additionalProperties}" + "SupportedPayGroupFields{id=$id, individualIds=$individualIds, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedPayStatementFields.Builder::class) @NoAutoDetect class SupportedPayStatementFields + @JsonCreator private constructor( - private val paging: JsonField, - private val payStatements: JsonField, - private val additionalProperties: Map, + @JsonProperty("paging") + @ExcludeMissing + private val paging: JsonField = JsonMissing.of(), + @JsonProperty("pay_statements") + @ExcludeMissing + private val payStatements: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun paging(): Optional = Optional.ofNullable(paging.getNullable("paging")) fun payStatements(): Optional = @@ -3759,6 +3948,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedPayStatementFields = apply { if (!validated) { paging().map { it.validate() } @@ -3783,34 +3974,30 @@ private constructor( @JvmSynthetic internal fun from(supportedPayStatementFields: SupportedPayStatementFields) = apply { - this.paging = supportedPayStatementFields.paging - this.payStatements = supportedPayStatementFields.payStatements - additionalProperties(supportedPayStatementFields.additionalProperties) + paging = supportedPayStatementFields.paging + payStatements = supportedPayStatementFields.payStatements + additionalProperties = + supportedPayStatementFields.additionalProperties.toMutableMap() } fun paging(paging: Paging) = paging(JsonField.of(paging)) - @JsonProperty("paging") - @ExcludeMissing fun paging(paging: JsonField) = apply { this.paging = paging } fun payStatements(payStatements: PayStatements) = payStatements(JsonField.of(payStatements)) - @JsonProperty("pay_statements") - @ExcludeMissing fun payStatements(payStatements: JsonField) = apply { this.payStatements = payStatements } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -3818,6 +4005,14 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedPayStatementFields = SupportedPayStatementFields( paging, @@ -3826,17 +4021,20 @@ private constructor( ) } - @JsonDeserialize(builder = Paging.Builder::class) @NoAutoDetect class Paging + @JsonCreator private constructor( - private val count: JsonField, - private val offset: JsonField, - private val additionalProperties: Map, + @JsonProperty("count") + @ExcludeMissing + private val count: JsonField = JsonMissing.of(), + @JsonProperty("offset") + @ExcludeMissing + private val offset: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun count(): Boolean = count.getRequired("count") fun offset(): Boolean = offset.getRequired("offset") @@ -3849,6 +4047,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Paging = apply { if (!validated) { count() @@ -3873,38 +4073,41 @@ private constructor( @JvmSynthetic internal fun from(paging: Paging) = apply { - this.count = paging.count - this.offset = paging.offset - additionalProperties(paging.additionalProperties) + count = paging.count + offset = paging.offset + additionalProperties = paging.additionalProperties.toMutableMap() } fun count(count: Boolean) = count(JsonField.of(count)) - @JsonProperty("count") - @ExcludeMissing fun count(count: JsonField) = apply { this.count = count } fun offset(offset: Boolean) = offset(JsonField.of(offset)) - @JsonProperty("offset") - @ExcludeMissing fun offset(offset: JsonField) = apply { this.offset = offset } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Paging = Paging( count, @@ -3931,42 +4134,46 @@ private constructor( "Paging{count=$count, offset=$offset, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PayStatements.Builder::class) @NoAutoDetect class PayStatements + @JsonCreator private constructor( - private val individualId: JsonField, - private val type: JsonField, - private val paymentMethod: JsonField, - private val totalHours: JsonField, - private val grossPay: JsonField, - private val netPay: JsonField, - private val earnings: JsonField, - private val employeeDeductions: JsonField, - private val employerContributions: JsonField, - private val taxes: JsonField, - private val additionalProperties: Map, + @JsonProperty("earnings") + @ExcludeMissing + private val earnings: JsonField = JsonMissing.of(), + @JsonProperty("employee_deductions") + @ExcludeMissing + private val employeeDeductions: JsonField = + JsonMissing.of(), + @JsonProperty("employer_contributions") + @ExcludeMissing + private val employerContributions: JsonField = + JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + private val grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + private val netPay: JsonField = JsonMissing.of(), + @JsonProperty("payment_method") + @ExcludeMissing + private val paymentMethod: JsonField = JsonMissing.of(), + @JsonProperty("taxes") + @ExcludeMissing + private val taxes: JsonField = JsonMissing.of(), + @JsonProperty("total_hours") + @ExcludeMissing + private val totalHours: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) - - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - - fun paymentMethod(): Optional = - Optional.ofNullable(paymentMethod.getNullable("payment_method")) - - fun totalHours(): Optional = - Optional.ofNullable(totalHours.getNullable("total_hours")) - - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) - - fun netPay(): Optional = - Optional.ofNullable(netPay.getNullable("net_pay")) - fun earnings(): Optional = Optional.ofNullable(earnings.getNullable("earnings")) @@ -3978,23 +4185,24 @@ private constructor( employerContributions.getNullable("employer_contributions") ) - fun taxes(): Optional = Optional.ofNullable(taxes.getNullable("taxes")) + fun grossPay(): Optional = + Optional.ofNullable(grossPay.getNullable("gross_pay")) - @JsonProperty("individual_id") - @ExcludeMissing - fun _individualId() = individualId + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun netPay(): Optional = + Optional.ofNullable(netPay.getNullable("net_pay")) - @JsonProperty("payment_method") - @ExcludeMissing - fun _paymentMethod() = paymentMethod + fun paymentMethod(): Optional = + Optional.ofNullable(paymentMethod.getNullable("payment_method")) - @JsonProperty("total_hours") @ExcludeMissing fun _totalHours() = totalHours + fun taxes(): Optional = Optional.ofNullable(taxes.getNullable("taxes")) - @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + fun totalHours(): Optional = + Optional.ofNullable(totalHours.getNullable("total_hours")) - @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) @JsonProperty("earnings") @ExcludeMissing fun _earnings() = earnings @@ -4006,24 +4214,42 @@ private constructor( @ExcludeMissing fun _employerContributions() = employerContributions + @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + + @JsonProperty("individual_id") + @ExcludeMissing + fun _individualId() = individualId + + @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + + @JsonProperty("payment_method") + @ExcludeMissing + fun _paymentMethod() = paymentMethod + @JsonProperty("taxes") @ExcludeMissing fun _taxes() = taxes + @JsonProperty("total_hours") @ExcludeMissing fun _totalHours() = totalHours + + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayStatements = apply { if (!validated) { - individualId() - type() - paymentMethod() - totalHours() - grossPay() - netPay() earnings().map { it.validate() } employeeDeductions().map { it.validate() } employerContributions().map { it.validate() } + grossPay() + individualId() + netPay() + paymentMethod() taxes().map { it.validate() } + totalHours() + type() validated = true } } @@ -4037,189 +4263,186 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var paymentMethod: JsonField = JsonMissing.of() - private var totalHours: JsonField = JsonMissing.of() - private var grossPay: JsonField = JsonMissing.of() - private var netPay: JsonField = JsonMissing.of() private var earnings: JsonField = JsonMissing.of() private var employeeDeductions: JsonField = JsonMissing.of() private var employerContributions: JsonField = JsonMissing.of() + private var grossPay: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() + private var netPay: JsonField = JsonMissing.of() + private var paymentMethod: JsonField = JsonMissing.of() private var taxes: JsonField = JsonMissing.of() + private var totalHours: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payStatements: PayStatements) = apply { - this.individualId = payStatements.individualId - this.type = payStatements.type - this.paymentMethod = payStatements.paymentMethod - this.totalHours = payStatements.totalHours - this.grossPay = payStatements.grossPay - this.netPay = payStatements.netPay - this.earnings = payStatements.earnings - this.employeeDeductions = payStatements.employeeDeductions - this.employerContributions = payStatements.employerContributions - this.taxes = payStatements.taxes - additionalProperties(payStatements.additionalProperties) + earnings = payStatements.earnings + employeeDeductions = payStatements.employeeDeductions + employerContributions = payStatements.employerContributions + grossPay = payStatements.grossPay + individualId = payStatements.individualId + netPay = payStatements.netPay + paymentMethod = payStatements.paymentMethod + taxes = payStatements.taxes + totalHours = payStatements.totalHours + type = payStatements.type + additionalProperties = payStatements.additionalProperties.toMutableMap() } - fun individualId(individualId: Boolean) = - individualId(JsonField.of(individualId)) + fun earnings(earnings: Earnings) = earnings(JsonField.of(earnings)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId + fun earnings(earnings: JsonField) = apply { + this.earnings = earnings } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun paymentMethod(paymentMethod: Boolean) = - paymentMethod(JsonField.of(paymentMethod)) + fun employeeDeductions(employeeDeductions: EmployeeDeductions) = + employeeDeductions(JsonField.of(employeeDeductions)) - @JsonProperty("payment_method") - @ExcludeMissing - fun paymentMethod(paymentMethod: JsonField) = apply { - this.paymentMethod = paymentMethod - } + fun employeeDeductions(employeeDeductions: JsonField) = + apply { + this.employeeDeductions = employeeDeductions + } - fun totalHours(totalHours: Boolean) = totalHours(JsonField.of(totalHours)) + fun employerContributions(employerContributions: EmployerContributions) = + employerContributions(JsonField.of(employerContributions)) - @JsonProperty("total_hours") - @ExcludeMissing - fun totalHours(totalHours: JsonField) = apply { - this.totalHours = totalHours - } + fun employerContributions( + employerContributions: JsonField + ) = apply { this.employerContributions = employerContributions } fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) - @JsonProperty("gross_pay") - @ExcludeMissing fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } - fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) - - @JsonProperty("net_pay") - @ExcludeMissing - fun netPay(netPay: JsonField) = apply { this.netPay = netPay } - - fun earnings(earnings: Earnings) = earnings(JsonField.of(earnings)) + fun individualId(individualId: Boolean) = + individualId(JsonField.of(individualId)) - @JsonProperty("earnings") - @ExcludeMissing - fun earnings(earnings: JsonField) = apply { - this.earnings = earnings + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId } - fun employeeDeductions(employeeDeductions: EmployeeDeductions) = - employeeDeductions(JsonField.of(employeeDeductions)) + fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) - @JsonProperty("employee_deductions") - @ExcludeMissing - fun employeeDeductions(employeeDeductions: JsonField) = - apply { - this.employeeDeductions = employeeDeductions - } + fun netPay(netPay: JsonField) = apply { this.netPay = netPay } - fun employerContributions(employerContributions: EmployerContributions) = - employerContributions(JsonField.of(employerContributions)) + fun paymentMethod(paymentMethod: Boolean) = + paymentMethod(JsonField.of(paymentMethod)) - @JsonProperty("employer_contributions") - @ExcludeMissing - fun employerContributions( - employerContributions: JsonField - ) = apply { this.employerContributions = employerContributions } + fun paymentMethod(paymentMethod: JsonField) = apply { + this.paymentMethod = paymentMethod + } fun taxes(taxes: Taxes) = taxes(JsonField.of(taxes)) - @JsonProperty("taxes") - @ExcludeMissing fun taxes(taxes: JsonField) = apply { this.taxes = taxes } + fun totalHours(totalHours: Boolean) = totalHours(JsonField.of(totalHours)) + + fun totalHours(totalHours: JsonField) = apply { + this.totalHours = totalHours + } + + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatements = PayStatements( - individualId, - type, - paymentMethod, - totalHours, - grossPay, - netPay, earnings, employeeDeductions, employerContributions, + grossPay, + individualId, + netPay, + paymentMethod, taxes, + totalHours, + type, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Earnings.Builder::class) @NoAutoDetect class Earnings + @JsonCreator private constructor( - private val type: JsonField, - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) - - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun name(): Optional = + Optional.ofNullable(name.getNullable("name")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun type(): Optional = + Optional.ofNullable(type.getNullable("type")) @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Earnings = apply { if (!validated) { - type() - name() amount() currency() + name() + type() validated = true } } @@ -4233,69 +4456,68 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(earnings: Earnings) = apply { - this.type = earnings.type - this.name = earnings.name - this.amount = earnings.amount - this.currency = earnings.currency - additionalProperties(earnings.additionalProperties) + amount = earnings.amount + currency = earnings.currency + name = earnings.name + type = earnings.type + additionalProperties = earnings.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) - - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + + fun type(type: Boolean) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Earnings = Earnings( - type, - name, amount, currency, + name, + type, additionalProperties.toImmutable(), ) } @@ -4305,69 +4527,81 @@ private constructor( return true } - return /* spotless:off */ other is Earnings && type == other.type && name == other.name && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Earnings && amount == other.amount && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Earnings{type=$type, name=$name, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "Earnings{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployeeDeductions.Builder::class) @NoAutoDetect class EmployeeDeductions + @JsonCreator private constructor( - private val name: JsonField, - private val amount: JsonField, - private val type: JsonField, - private val preTax: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("pre_tax") + @ExcludeMissing + private val preTax: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false + fun amount(): Optional = + Optional.ofNullable(amount.getNullable("amount")) + + fun currency(): Optional = + Optional.ofNullable(currency.getNullable("currency")) fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - fun amount(): Optional = - Optional.ofNullable(amount.getNullable("amount")) + fun preTax(): Optional = + Optional.ofNullable(preTax.getNullable("pre_tax")) fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - fun preTax(): Optional = - Optional.ofNullable(preTax.getNullable("pre_tax")) + @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - fun currency(): Optional = - Optional.ofNullable(currency.getNullable("currency")) + @JsonProperty("currency") @ExcludeMissing fun _currency() = currency @JsonProperty("name") @ExcludeMissing fun _name() = name - @JsonProperty("amount") @ExcludeMissing fun _amount() = amount - - @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("pre_tax") @ExcludeMissing fun _preTax() = preTax - @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmployeeDeductions = apply { if (!validated) { - name() amount() - type() - preTax() currency() + name() + preTax() + type() validated = true } } @@ -4381,78 +4615,76 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var preTax: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var preTax: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employeeDeductions: EmployeeDeductions) = apply { - this.name = employeeDeductions.name - this.amount = employeeDeductions.amount - this.type = employeeDeductions.type - this.preTax = employeeDeductions.preTax - this.currency = employeeDeductions.currency - additionalProperties(employeeDeductions.additionalProperties) + amount = employeeDeductions.amount + currency = employeeDeductions.currency + name = employeeDeductions.name + preTax = employeeDeductions.preTax + type = employeeDeductions.type + additionalProperties = + employeeDeductions.additionalProperties.toMutableMap() } - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } - fun type(type: Boolean) = type(JsonField.of(type)) + fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + fun currency(currency: JsonField) = apply { + this.currency = currency + } + + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } fun preTax(preTax: Boolean) = preTax(JsonField.of(preTax)) - @JsonProperty("pre_tax") - @ExcludeMissing fun preTax(preTax: JsonField) = apply { this.preTax = preTax } - fun currency(currency: Boolean) = currency(JsonField.of(currency)) + fun type(type: Boolean) = type(JsonField.of(type)) - @JsonProperty("currency") - @ExcludeMissing - fun currency(currency: JsonField) = apply { - this.currency = currency - } + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployeeDeductions = EmployeeDeductions( - name, amount, - type, - preTax, currency, + name, + preTax, + type, additionalProperties.toImmutable(), ) } @@ -4462,55 +4694,63 @@ private constructor( return true } - return /* spotless:off */ other is EmployeeDeductions && name == other.name && amount == other.amount && type == other.type && preTax == other.preTax && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployeeDeductions && amount == other.amount && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, type, preTax, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, preTax, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployeeDeductions{name=$name, amount=$amount, type=$type, preTax=$preTax, currency=$currency, additionalProperties=$additionalProperties}" + "EmployeeDeductions{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployerContributions.Builder::class) @NoAutoDetect class EmployerContributions + @JsonCreator private constructor( - private val name: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = + Optional.ofNullable(name.getNullable("name")) @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): EmployerContributions = apply { if (!validated) { - name() amount() currency() + name() validated = true } } @@ -4524,61 +4764,63 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employerContributions: EmployerContributions) = apply { - this.name = employerContributions.name - this.amount = employerContributions.amount - this.currency = employerContributions.currency - additionalProperties(employerContributions.additionalProperties) + amount = employerContributions.amount + currency = employerContributions.currency + name = employerContributions.name + additionalProperties = + employerContributions.additionalProperties.toMutableMap() } - fun name(name: Boolean) = name(JsonField.of(name)) - - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("amount") - @ExcludeMissing fun amount(amount: JsonField) = apply { this.amount = amount } fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("currency") - @ExcludeMissing fun currency(currency: JsonField) = apply { this.currency = currency } + fun name(name: Boolean) = name(JsonField.of(name)) + + fun name(name: JsonField) = apply { this.name = name } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployerContributions = EmployerContributions( - name, amount, currency, + name, additionalProperties.toImmutable(), ) } @@ -4588,69 +4830,81 @@ private constructor( return true } - return /* spotless:off */ other is EmployerContributions && name == other.name && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployerContributions && amount == other.amount && currency == other.currency && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployerContributions{name=$name, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "EmployerContributions{amount=$amount, currency=$currency, name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Taxes.Builder::class) @NoAutoDetect class Taxes + @JsonCreator private constructor( - private val type: JsonField, - private val name: JsonField, - private val employer: JsonField, - private val amount: JsonField, - private val currency: JsonField, - private val additionalProperties: Map, + @JsonProperty("amount") + @ExcludeMissing + private val amount: JsonField = JsonMissing.of(), + @JsonProperty("currency") + @ExcludeMissing + private val currency: JsonField = JsonMissing.of(), + @JsonProperty("employer") + @ExcludeMissing + private val employer: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = + immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun type(): Optional = - Optional.ofNullable(type.getNullable("type")) - - fun name(): Optional = - Optional.ofNullable(name.getNullable("name")) - - fun employer(): Optional = - Optional.ofNullable(employer.getNullable("employer")) - fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) - @JsonProperty("type") @ExcludeMissing fun _type() = type + fun employer(): Optional = + Optional.ofNullable(employer.getNullable("employer")) - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = + Optional.ofNullable(name.getNullable("name")) - @JsonProperty("employer") @ExcludeMissing fun _employer() = employer + fun type(): Optional = + Optional.ofNullable(type.getNullable("type")) @JsonProperty("amount") @ExcludeMissing fun _amount() = amount @JsonProperty("currency") @ExcludeMissing fun _currency() = currency + @JsonProperty("employer") @ExcludeMissing fun _employer() = employer + + @JsonProperty("name") @ExcludeMissing fun _name() = name + + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): Taxes = apply { - if (!validated) { - type() - name() - employer() + private var validated: Boolean = false + + fun validate(): Taxes = apply { + if (!validated) { amount() currency() + employer() + name() + type() validated = true } } @@ -4664,80 +4918,77 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var employer: JsonField = JsonMissing.of() private var amount: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() + private var employer: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(taxes: Taxes) = apply { - this.type = taxes.type - this.name = taxes.name - this.employer = taxes.employer - this.amount = taxes.amount - this.currency = taxes.currency - additionalProperties(taxes.additionalProperties) + amount = taxes.amount + currency = taxes.currency + employer = taxes.employer + name = taxes.name + type = taxes.type + additionalProperties = taxes.additionalProperties.toMutableMap() } - fun type(type: Boolean) = type(JsonField.of(type)) + fun amount(amount: Boolean) = amount(JsonField.of(amount)) - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } + fun amount(amount: JsonField) = apply { this.amount = amount } - fun name(name: Boolean) = name(JsonField.of(name)) + fun currency(currency: Boolean) = currency(JsonField.of(currency)) - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } + fun currency(currency: JsonField) = apply { + this.currency = currency + } fun employer(employer: Boolean) = employer(JsonField.of(employer)) - @JsonProperty("employer") - @ExcludeMissing fun employer(employer: JsonField) = apply { this.employer = employer } - fun amount(amount: Boolean) = amount(JsonField.of(amount)) + fun name(name: Boolean) = name(JsonField.of(name)) - @JsonProperty("amount") - @ExcludeMissing - fun amount(amount: JsonField) = apply { this.amount = amount } + fun name(name: JsonField) = apply { this.name = name } - fun currency(currency: Boolean) = currency(JsonField.of(currency)) + fun type(type: Boolean) = type(JsonField.of(type)) - @JsonProperty("currency") - @ExcludeMissing - fun currency(currency: JsonField) = apply { - this.currency = currency - } + fun type(type: JsonField) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Taxes = Taxes( - type, - name, - employer, amount, currency, + employer, + name, + type, additionalProperties.toImmutable(), ) } @@ -4747,17 +4998,17 @@ private constructor( return true } - return /* spotless:off */ other is Taxes && type == other.type && name == other.name && employer == other.employer && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Taxes && amount == other.amount && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, employer, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, employer, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Taxes{type=$type, name=$name, employer=$employer, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "Taxes{amount=$amount, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -4765,17 +5016,17 @@ private constructor( return true } - return /* spotless:off */ other is PayStatements && individualId == other.individualId && type == other.type && paymentMethod == other.paymentMethod && totalHours == other.totalHours && grossPay == other.grossPay && netPay == other.netPay && earnings == other.earnings && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && taxes == other.taxes && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayStatements && earnings == other.earnings && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && grossPay == other.grossPay && individualId == other.individualId && netPay == other.netPay && paymentMethod == other.paymentMethod && taxes == other.taxes && totalHours == other.totalHours && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, type, paymentMethod, totalHours, grossPay, netPay, earnings, employeeDeductions, employerContributions, taxes, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(earnings, employeeDeductions, employerContributions, grossPay, individualId, netPay, paymentMethod, taxes, totalHours, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayStatements{individualId=$individualId, type=$type, paymentMethod=$paymentMethod, totalHours=$totalHours, grossPay=$grossPay, netPay=$netPay, earnings=$earnings, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, taxes=$taxes, additionalProperties=$additionalProperties}" + "PayStatements{earnings=$earnings, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, grossPay=$grossPay, individualId=$individualId, netPay=$netPay, paymentMethod=$paymentMethod, taxes=$taxes, totalHours=$totalHours, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -4796,105 +5047,130 @@ private constructor( "SupportedPayStatementFields{paging=$paging, payStatements=$payStatements, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = SupportedPaymentFields.Builder::class) @NoAutoDetect class SupportedPaymentFields + @JsonCreator private constructor( - private val id: JsonField, - private val payDate: JsonField, - private val debitDate: JsonField, - private val companyDebit: JsonField, - private val grossPay: JsonField, - private val netPay: JsonField, - private val employerTaxes: JsonField, - private val employeeTaxes: JsonField, - private val individualIds: JsonField, - private val payPeriod: JsonField, - private val payGroupIds: JsonField, - private val payFrequencies: JsonField, - private val additionalProperties: Map, + @JsonProperty("id") + @ExcludeMissing + private val id: JsonField = JsonMissing.of(), + @JsonProperty("company_debit") + @ExcludeMissing + private val companyDebit: JsonField = JsonMissing.of(), + @JsonProperty("debit_date") + @ExcludeMissing + private val debitDate: JsonField = JsonMissing.of(), + @JsonProperty("employee_taxes") + @ExcludeMissing + private val employeeTaxes: JsonField = JsonMissing.of(), + @JsonProperty("employer_taxes") + @ExcludeMissing + private val employerTaxes: JsonField = JsonMissing.of(), + @JsonProperty("gross_pay") + @ExcludeMissing + private val grossPay: JsonField = JsonMissing.of(), + @JsonProperty("individual_ids") + @ExcludeMissing + private val individualIds: JsonField = JsonMissing.of(), + @JsonProperty("net_pay") + @ExcludeMissing + private val netPay: JsonField = JsonMissing.of(), + @JsonProperty("pay_date") + @ExcludeMissing + private val payDate: JsonField = JsonMissing.of(), + @JsonProperty("pay_frequencies") + @ExcludeMissing + private val payFrequencies: JsonField = JsonMissing.of(), + @JsonProperty("pay_group_ids") + @ExcludeMissing + private val payGroupIds: JsonField = JsonMissing.of(), + @JsonProperty("pay_period") + @ExcludeMissing + private val payPeriod: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun id(): Optional = Optional.ofNullable(id.getNullable("id")) - fun payDate(): Optional = - Optional.ofNullable(payDate.getNullable("pay_date")) - - fun debitDate(): Optional = - Optional.ofNullable(debitDate.getNullable("debit_date")) - fun companyDebit(): Optional = Optional.ofNullable(companyDebit.getNullable("company_debit")) - fun grossPay(): Optional = - Optional.ofNullable(grossPay.getNullable("gross_pay")) + fun debitDate(): Optional = + Optional.ofNullable(debitDate.getNullable("debit_date")) - fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) + fun employeeTaxes(): Optional = + Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) fun employerTaxes(): Optional = Optional.ofNullable(employerTaxes.getNullable("employer_taxes")) - fun employeeTaxes(): Optional = - Optional.ofNullable(employeeTaxes.getNullable("employee_taxes")) + fun grossPay(): Optional = + Optional.ofNullable(grossPay.getNullable("gross_pay")) fun individualIds(): Optional = Optional.ofNullable(individualIds.getNullable("individual_ids")) - fun payPeriod(): Optional = - Optional.ofNullable(payPeriod.getNullable("pay_period")) + fun netPay(): Optional = Optional.ofNullable(netPay.getNullable("net_pay")) - fun payGroupIds(): Optional = - Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) + fun payDate(): Optional = + Optional.ofNullable(payDate.getNullable("pay_date")) fun payFrequencies(): Optional = Optional.ofNullable(payFrequencies.getNullable("pay_frequencies")) - @JsonProperty("id") @ExcludeMissing fun _id() = id + fun payGroupIds(): Optional = + Optional.ofNullable(payGroupIds.getNullable("pay_group_ids")) - @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate + fun payPeriod(): Optional = + Optional.ofNullable(payPeriod.getNullable("pay_period")) - @JsonProperty("debit_date") @ExcludeMissing fun _debitDate() = debitDate + @JsonProperty("id") @ExcludeMissing fun _id() = id @JsonProperty("company_debit") @ExcludeMissing fun _companyDebit() = companyDebit - @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay + @JsonProperty("debit_date") @ExcludeMissing fun _debitDate() = debitDate - @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay + @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes() = employeeTaxes @JsonProperty("employer_taxes") @ExcludeMissing fun _employerTaxes() = employerTaxes - @JsonProperty("employee_taxes") @ExcludeMissing fun _employeeTaxes() = employeeTaxes + @JsonProperty("gross_pay") @ExcludeMissing fun _grossPay() = grossPay @JsonProperty("individual_ids") @ExcludeMissing fun _individualIds() = individualIds - @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod + @JsonProperty("net_pay") @ExcludeMissing fun _netPay() = netPay - @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds + @JsonProperty("pay_date") @ExcludeMissing fun _payDate() = payDate @JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies + @JsonProperty("pay_group_ids") @ExcludeMissing fun _payGroupIds() = payGroupIds + + @JsonProperty("pay_period") @ExcludeMissing fun _payPeriod() = payPeriod + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedPaymentFields = apply { if (!validated) { id() - payDate() - debitDate() companyDebit() - grossPay() - netPay() - employerTaxes() + debitDate() employeeTaxes() + employerTaxes() + grossPay() individualIds() - payPeriod().map { it.validate() } - payGroupIds() + netPay() + payDate() payFrequencies() + payGroupIds() + payPeriod().map { it.validate() } validated = true } } @@ -4909,137 +5185,113 @@ private constructor( class Builder { private var id: JsonField = JsonMissing.of() - private var payDate: JsonField = JsonMissing.of() - private var debitDate: JsonField = JsonMissing.of() private var companyDebit: JsonField = JsonMissing.of() - private var grossPay: JsonField = JsonMissing.of() - private var netPay: JsonField = JsonMissing.of() - private var employerTaxes: JsonField = JsonMissing.of() + private var debitDate: JsonField = JsonMissing.of() private var employeeTaxes: JsonField = JsonMissing.of() + private var employerTaxes: JsonField = JsonMissing.of() + private var grossPay: JsonField = JsonMissing.of() private var individualIds: JsonField = JsonMissing.of() - private var payPeriod: JsonField = JsonMissing.of() - private var payGroupIds: JsonField = JsonMissing.of() + private var netPay: JsonField = JsonMissing.of() + private var payDate: JsonField = JsonMissing.of() private var payFrequencies: JsonField = JsonMissing.of() + private var payGroupIds: JsonField = JsonMissing.of() + private var payPeriod: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedPaymentFields: SupportedPaymentFields) = apply { - this.id = supportedPaymentFields.id - this.payDate = supportedPaymentFields.payDate - this.debitDate = supportedPaymentFields.debitDate - this.companyDebit = supportedPaymentFields.companyDebit - this.grossPay = supportedPaymentFields.grossPay - this.netPay = supportedPaymentFields.netPay - this.employerTaxes = supportedPaymentFields.employerTaxes - this.employeeTaxes = supportedPaymentFields.employeeTaxes - this.individualIds = supportedPaymentFields.individualIds - this.payPeriod = supportedPaymentFields.payPeriod - this.payGroupIds = supportedPaymentFields.payGroupIds - this.payFrequencies = supportedPaymentFields.payFrequencies - additionalProperties(supportedPaymentFields.additionalProperties) + id = supportedPaymentFields.id + companyDebit = supportedPaymentFields.companyDebit + debitDate = supportedPaymentFields.debitDate + employeeTaxes = supportedPaymentFields.employeeTaxes + employerTaxes = supportedPaymentFields.employerTaxes + grossPay = supportedPaymentFields.grossPay + individualIds = supportedPaymentFields.individualIds + netPay = supportedPaymentFields.netPay + payDate = supportedPaymentFields.payDate + payFrequencies = supportedPaymentFields.payFrequencies + payGroupIds = supportedPaymentFields.payGroupIds + payPeriod = supportedPaymentFields.payPeriod + additionalProperties = + supportedPaymentFields.additionalProperties.toMutableMap() } fun id(id: Boolean) = id(JsonField.of(id)) - @JsonProperty("id") - @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } - fun payDate(payDate: Boolean) = payDate(JsonField.of(payDate)) - - @JsonProperty("pay_date") - @ExcludeMissing - fun payDate(payDate: JsonField) = apply { this.payDate = payDate } - - fun debitDate(debitDate: Boolean) = debitDate(JsonField.of(debitDate)) - - @JsonProperty("debit_date") - @ExcludeMissing - fun debitDate(debitDate: JsonField) = apply { - this.debitDate = debitDate - } - fun companyDebit(companyDebit: Boolean) = companyDebit(JsonField.of(companyDebit)) - @JsonProperty("company_debit") - @ExcludeMissing fun companyDebit(companyDebit: JsonField) = apply { this.companyDebit = companyDebit } - fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) + fun debitDate(debitDate: Boolean) = debitDate(JsonField.of(debitDate)) - @JsonProperty("gross_pay") - @ExcludeMissing - fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } + fun debitDate(debitDate: JsonField) = apply { + this.debitDate = debitDate + } - fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) + fun employeeTaxes(employeeTaxes: Boolean) = + employeeTaxes(JsonField.of(employeeTaxes)) - @JsonProperty("net_pay") - @ExcludeMissing - fun netPay(netPay: JsonField) = apply { this.netPay = netPay } + fun employeeTaxes(employeeTaxes: JsonField) = apply { + this.employeeTaxes = employeeTaxes + } fun employerTaxes(employerTaxes: Boolean) = employerTaxes(JsonField.of(employerTaxes)) - @JsonProperty("employer_taxes") - @ExcludeMissing fun employerTaxes(employerTaxes: JsonField) = apply { this.employerTaxes = employerTaxes } - fun employeeTaxes(employeeTaxes: Boolean) = - employeeTaxes(JsonField.of(employeeTaxes)) + fun grossPay(grossPay: Boolean) = grossPay(JsonField.of(grossPay)) - @JsonProperty("employee_taxes") - @ExcludeMissing - fun employeeTaxes(employeeTaxes: JsonField) = apply { - this.employeeTaxes = employeeTaxes - } + fun grossPay(grossPay: JsonField) = apply { this.grossPay = grossPay } fun individualIds(individualIds: Boolean) = individualIds(JsonField.of(individualIds)) - @JsonProperty("individual_ids") - @ExcludeMissing fun individualIds(individualIds: JsonField) = apply { this.individualIds = individualIds } - fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) + fun netPay(netPay: Boolean) = netPay(JsonField.of(netPay)) - @JsonProperty("pay_period") - @ExcludeMissing - fun payPeriod(payPeriod: JsonField) = apply { - this.payPeriod = payPeriod + fun netPay(netPay: JsonField) = apply { this.netPay = netPay } + + fun payDate(payDate: Boolean) = payDate(JsonField.of(payDate)) + + fun payDate(payDate: JsonField) = apply { this.payDate = payDate } + + fun payFrequencies(payFrequencies: Boolean) = + payFrequencies(JsonField.of(payFrequencies)) + + fun payFrequencies(payFrequencies: JsonField) = apply { + this.payFrequencies = payFrequencies } fun payGroupIds(payGroupIds: Boolean) = payGroupIds(JsonField.of(payGroupIds)) - @JsonProperty("pay_group_ids") - @ExcludeMissing fun payGroupIds(payGroupIds: JsonField) = apply { this.payGroupIds = payGroupIds } - fun payFrequencies(payFrequencies: Boolean) = - payFrequencies(JsonField.of(payFrequencies)) + fun payPeriod(payPeriod: PayPeriod) = payPeriod(JsonField.of(payPeriod)) - @JsonProperty("pay_frequencies") - @ExcludeMissing - fun payFrequencies(payFrequencies: JsonField) = apply { - this.payFrequencies = payFrequencies + fun payPeriod(payPeriod: JsonField) = apply { + this.payPeriod = payPeriod } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -5047,53 +5299,66 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedPaymentFields = SupportedPaymentFields( id, - payDate, - debitDate, companyDebit, - grossPay, - netPay, - employerTaxes, + debitDate, employeeTaxes, + employerTaxes, + grossPay, individualIds, - payPeriod, - payGroupIds, + netPay, + payDate, payFrequencies, + payGroupIds, + payPeriod, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = PayPeriod.Builder::class) @NoAutoDetect class PayPeriod + @JsonCreator private constructor( - private val startDate: JsonField, - private val endDate: JsonField, - private val additionalProperties: Map, + @JsonProperty("end_date") + @ExcludeMissing + private val endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + private val startDate: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun endDate(): Optional = + Optional.ofNullable(endDate.getNullable("end_date")) fun startDate(): Optional = Optional.ofNullable(startDate.getNullable("start_date")) - fun endDate(): Optional = - Optional.ofNullable(endDate.getNullable("end_date")) + @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate @JsonProperty("start_date") @ExcludeMissing fun _startDate() = startDate - @JsonProperty("end_date") @ExcludeMissing fun _endDate() = endDate - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): PayPeriod = apply { if (!validated) { - startDate() endDate() + startDate() validated = true } } @@ -5107,51 +5372,54 @@ private constructor( class Builder { - private var startDate: JsonField = JsonMissing.of() private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(payPeriod: PayPeriod) = apply { - this.startDate = payPeriod.startDate - this.endDate = payPeriod.endDate - additionalProperties(payPeriod.additionalProperties) + endDate = payPeriod.endDate + startDate = payPeriod.startDate + additionalProperties = payPeriod.additionalProperties.toMutableMap() } + fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) + + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + fun startDate(startDate: Boolean) = startDate(JsonField.of(startDate)) - @JsonProperty("start_date") - @ExcludeMissing fun startDate(startDate: JsonField) = apply { this.startDate = startDate } - fun endDate(endDate: Boolean) = endDate(JsonField.of(endDate)) - - @JsonProperty("end_date") - @ExcludeMissing - fun endDate(endDate: JsonField) = apply { this.endDate = endDate } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties( additionalProperties: Map ) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayPeriod = PayPeriod( - startDate, endDate, + startDate, additionalProperties.toImmutable(), ) } @@ -5161,17 +5429,17 @@ private constructor( return true } - return /* spotless:off */ other is PayPeriod && startDate == other.startDate && endDate == other.endDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayPeriod && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(startDate, endDate, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PayPeriod{startDate=$startDate, endDate=$endDate, additionalProperties=$additionalProperties}" + "PayPeriod{endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5179,17 +5447,17 @@ private constructor( return true } - return /* spotless:off */ other is SupportedPaymentFields && id == other.id && payDate == other.payDate && debitDate == other.debitDate && companyDebit == other.companyDebit && grossPay == other.grossPay && netPay == other.netPay && employerTaxes == other.employerTaxes && employeeTaxes == other.employeeTaxes && individualIds == other.individualIds && payPeriod == other.payPeriod && payGroupIds == other.payGroupIds && payFrequencies == other.payFrequencies && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedPaymentFields && id == other.id && companyDebit == other.companyDebit && debitDate == other.debitDate && employeeTaxes == other.employeeTaxes && employerTaxes == other.employerTaxes && grossPay == other.grossPay && individualIds == other.individualIds && netPay == other.netPay && payDate == other.payDate && payFrequencies == other.payFrequencies && payGroupIds == other.payGroupIds && payPeriod == other.payPeriod && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, payDate, debitDate, companyDebit, grossPay, netPay, employerTaxes, employeeTaxes, individualIds, payPeriod, payGroupIds, payFrequencies, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, companyDebit, debitDate, employeeTaxes, employerTaxes, grossPay, individualIds, netPay, payDate, payFrequencies, payGroupIds, payPeriod, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedPaymentFields{id=$id, payDate=$payDate, debitDate=$debitDate, companyDebit=$companyDebit, grossPay=$grossPay, netPay=$netPay, employerTaxes=$employerTaxes, employeeTaxes=$employeeTaxes, individualIds=$individualIds, payPeriod=$payPeriod, payGroupIds=$payGroupIds, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}" + "SupportedPaymentFields{id=$id, companyDebit=$companyDebit, debitDate=$debitDate, employeeTaxes=$employeeTaxes, employerTaxes=$employerTaxes, grossPay=$grossPay, individualIds=$individualIds, netPay=$netPay, payDate=$payDate, payFrequencies=$payFrequencies, payGroupIds=$payGroupIds, payPeriod=$payPeriod, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5197,17 +5465,17 @@ private constructor( return true } - return /* spotless:off */ other is SupportedFields && company == other.company && directory == other.directory && individual == other.individual && employment == other.employment && payment == other.payment && payStatement == other.payStatement && payGroup == other.payGroup && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedFields && company == other.company && directory == other.directory && employment == other.employment && individual == other.individual && payGroup == other.payGroup && payStatement == other.payStatement && payment == other.payment && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(company, directory, individual, employment, payment, payStatement, payGroup, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(company, directory, employment, individual, payGroup, payStatement, payment, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedFields{company=$company, directory=$directory, individual=$individual, employment=$employment, payment=$payment, payStatement=$payStatement, payGroup=$payGroup, additionalProperties=$additionalProperties}" + "SupportedFields{company=$company, directory=$directory, employment=$employment, individual=$individual, payGroup=$payGroup, payStatement=$payStatement, payment=$payment, additionalProperties=$additionalProperties}" } class Type @@ -5290,17 +5558,17 @@ private constructor( return true } - return /* spotless:off */ other is AuthenticationMethod && type == other.type && benefitsSupport == other.benefitsSupport && supportedFields == other.supportedFields && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is AuthenticationMethod && benefitsSupport == other.benefitsSupport && supportedFields == other.supportedFields && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, benefitsSupport, supportedFields, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(benefitsSupport, supportedFields, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "AuthenticationMethod{type=$type, benefitsSupport=$benefitsSupport, supportedFields=$supportedFields, additionalProperties=$additionalProperties}" + "AuthenticationMethod{benefitsSupport=$benefitsSupport, supportedFields=$supportedFields, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -5308,15 +5576,15 @@ private constructor( return true } - return /* spotless:off */ other is Provider && id == other.id && displayName == other.displayName && products == other.products && icon == other.icon && logo == other.logo && mfaRequired == other.mfaRequired && primaryColor == other.primaryColor && manual == other.manual && beta == other.beta && authenticationMethods == other.authenticationMethods && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Provider && id == other.id && authenticationMethods == other.authenticationMethods && beta == other.beta && displayName == other.displayName && icon == other.icon && logo == other.logo && manual == other.manual && mfaRequired == other.mfaRequired && primaryColor == other.primaryColor && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, displayName, products, icon, logo, mfaRequired, primaryColor, manual, beta, authenticationMethods, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, authenticationMethods, beta, displayName, icon, logo, manual, mfaRequired, primaryColor, products, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Provider{id=$id, displayName=$displayName, products=$products, icon=$icon, logo=$logo, mfaRequired=$mfaRequired, primaryColor=$primaryColor, manual=$manual, beta=$beta, authenticationMethods=$authenticationMethods, additionalProperties=$additionalProperties}" + "Provider{id=$id, authenticationMethods=$authenticationMethods, beta=$beta, displayName=$displayName, icon=$icon, logo=$logo, manual=$manual, mfaRequired=$mfaRequired, primaryColor=$primaryColor, products=$products, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 9496f5c8..9f4ad152 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.blocking.ProviderService import java.util.Objects @@ -67,12 +68,13 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -126,10 +128,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index 6344fb83..607497d1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -4,13 +4,14 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.services.async.ProviderServiceAsync import java.util.Objects @@ -74,12 +75,13 @@ private constructor( ) } - @JsonDeserialize(builder = Response.Builder::class) @NoAutoDetect class Response + @JsonCreator constructor( - private val items: JsonField>, - private val additionalProperties: Map, + @JsonProperty("items") private val items: JsonField> = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { private var validated: Boolean = false @@ -133,10 +135,8 @@ private constructor( fun items(items: List) = items(JsonField.of(items)) - @JsonProperty("items") fun items(items: JsonField>) = apply { this.items = items } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { this.additionalProperties.put(key, value) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 674264ae..66c45651 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -4,104 +4,112 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional class RequestForwardingForwardParams constructor( - private val method: String, - private val route: String, - private val data: String?, - private val headers: JsonValue?, - private val params: JsonValue?, + private val body: RequestForwardingForwardBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun method(): String = method - - fun route(): String = route - - fun data(): Optional = Optional.ofNullable(data) - - fun headers(): Optional = Optional.ofNullable(headers) - - fun params(): Optional = Optional.ofNullable(params) + /** + * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , + * `DELETE` , and `PATCH`. + */ + fun method(): String = body.method() + + /** + * The URL route path for the forwarded request. This value must begin with a forward-slash ( / + * ) and may only contain alphanumeric characters, hyphens, and underscores. + */ + fun route(): String = body.route() + + /** + * The body for the forwarded request. This value must be specified as either a string or a + * valid JSON object. + */ + fun data(): Optional = body.data() + + /** + * The HTTP headers to include on the forwarded request. This value must be specified as an + * object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": + * "v1" }` + */ + fun headers(): Optional = body.headers() + + /** + * The query parameters for the forwarded request. This value must be specified as a valid JSON + * object rather than a query string. + */ + fun params(): Optional = body.params() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): RequestForwardingForwardBody { - return RequestForwardingForwardBody( - method, - route, - data, - headers, - params, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): RequestForwardingForwardBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams /** Forward Request Body */ - @JsonDeserialize(builder = RequestForwardingForwardBody.Builder::class) @NoAutoDetect class RequestForwardingForwardBody + @JsonCreator internal constructor( - private val method: String?, - private val route: String?, - private val data: String?, - private val headers: JsonValue?, - private val params: JsonValue?, - private val additionalProperties: Map, + @JsonProperty("method") private val method: String, + @JsonProperty("route") private val route: String, + @JsonProperty("data") private val data: String?, + @JsonProperty("headers") private val headers: JsonValue?, + @JsonProperty("params") private val params: JsonValue?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , * `DELETE` , and `PATCH`. */ - @JsonProperty("method") fun method(): String? = method + @JsonProperty("method") fun method(): String = method /** * The URL route path for the forwarded request. This value must begin with a forward-slash * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. */ - @JsonProperty("route") fun route(): String? = route + @JsonProperty("route") fun route(): String = route /** * The body for the forwarded request. This value must be specified as either a string or a * valid JSON object. */ - @JsonProperty("data") fun data(): String? = data + @JsonProperty("data") fun data(): Optional = Optional.ofNullable(data) /** * The HTTP headers to include on the forwarded request. This value must be specified as an * object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": * "v1" }` */ - @JsonProperty("headers") fun headers(): JsonValue? = headers + @JsonProperty("headers") fun headers(): Optional = Optional.ofNullable(headers) /** * The query parameters for the forwarded request. This value must be specified as a valid * JSON object rather than a query string. */ - @JsonProperty("params") fun params(): JsonValue? = params + @JsonProperty("params") fun params(): Optional = Optional.ofNullable(params) @JsonAnyGetter @ExcludeMissing @@ -125,61 +133,85 @@ constructor( @JvmSynthetic internal fun from(requestForwardingForwardBody: RequestForwardingForwardBody) = apply { - this.method = requestForwardingForwardBody.method - this.route = requestForwardingForwardBody.route - this.data = requestForwardingForwardBody.data - this.headers = requestForwardingForwardBody.headers - this.params = requestForwardingForwardBody.params - additionalProperties(requestForwardingForwardBody.additionalProperties) + method = requestForwardingForwardBody.method + route = requestForwardingForwardBody.route + data = requestForwardingForwardBody.data + headers = requestForwardingForwardBody.headers + params = requestForwardingForwardBody.params + additionalProperties = + requestForwardingForwardBody.additionalProperties.toMutableMap() } /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , * `PUT` , `DELETE` , and `PATCH`. */ - @JsonProperty("method") fun method(method: String) = apply { this.method = method } + fun method(method: String) = apply { this.method = method } /** * The URL route path for the forwarded request. This value must begin with a * forward-slash ( / ) and may only contain alphanumeric characters, hyphens, and * underscores. */ - @JsonProperty("route") fun route(route: String) = apply { this.route = route } + fun route(route: String) = apply { this.route = route } + + /** + * The body for the forwarded request. This value must be specified as either a string + * or a valid JSON object. + */ + fun data(data: String?) = apply { this.data = data } /** * The body for the forwarded request. This value must be specified as either a string * or a valid JSON object. */ - @JsonProperty("data") fun data(data: String) = apply { this.data = data } + fun data(data: Optional) = data(data.orElse(null)) /** * The HTTP headers to include on the forwarded request. This value must be specified as * an object of key-value pairs. Example: `{"Content-Type": "application/xml", * "X-API-Version": "v1" }` */ - @JsonProperty("headers") - fun headers(headers: JsonValue) = apply { this.headers = headers } + fun headers(headers: JsonValue?) = apply { this.headers = headers } + + /** + * The HTTP headers to include on the forwarded request. This value must be specified as + * an object of key-value pairs. Example: `{"Content-Type": "application/xml", + * "X-API-Version": "v1" }` + */ + fun headers(headers: Optional) = headers(headers.orElse(null)) + + /** + * The query parameters for the forwarded request. This value must be specified as a + * valid JSON object rather than a query string. + */ + fun params(params: JsonValue?) = apply { this.params = params } /** * The query parameters for the forwarded request. This value must be specified as a * valid JSON object rather than a query string. */ - @JsonProperty("params") fun params(params: JsonValue) = apply { this.params = params } + fun params(params: Optional) = params(params.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): RequestForwardingForwardBody = RequestForwardingForwardBody( checkNotNull(method) { "`method` is required but was not set" }, @@ -219,58 +251,67 @@ constructor( @NoAutoDetect class Builder { - private var method: String? = null - private var route: String? = null - private var data: String? = null - private var headers: JsonValue? = null - private var params: JsonValue? = null + private var body: RequestForwardingForwardBody.Builder = + RequestForwardingForwardBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(requestForwardingForwardParams: RequestForwardingForwardParams) = apply { - method = requestForwardingForwardParams.method - route = requestForwardingForwardParams.route - data = requestForwardingForwardParams.data - headers = requestForwardingForwardParams.headers - params = requestForwardingForwardParams.params + body = requestForwardingForwardParams.body.toBuilder() additionalHeaders = requestForwardingForwardParams.additionalHeaders.toBuilder() additionalQueryParams = requestForwardingForwardParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - requestForwardingForwardParams.additionalBodyProperties.toMutableMap() } /** * The HTTP method for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , * `DELETE` , and `PATCH`. */ - fun method(method: String) = apply { this.method = method } + fun method(method: String) = apply { body.method(method) } /** * The URL route path for the forwarded request. This value must begin with a forward-slash * ( / ) and may only contain alphanumeric characters, hyphens, and underscores. */ - fun route(route: String) = apply { this.route = route } + fun route(route: String) = apply { body.route(route) } /** * The body for the forwarded request. This value must be specified as either a string or a * valid JSON object. */ - fun data(data: String) = apply { this.data = data } + fun data(data: String?) = apply { body.data(data) } + + /** + * The body for the forwarded request. This value must be specified as either a string or a + * valid JSON object. + */ + fun data(data: Optional) = data(data.orElse(null)) /** * The HTTP headers to include on the forwarded request. This value must be specified as an * object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": * "v1" }` */ - fun headers(headers: JsonValue) = apply { this.headers = headers } + fun headers(headers: JsonValue?) = apply { body.headers(headers) } + + /** + * The HTTP headers to include on the forwarded request. This value must be specified as an + * object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": + * "v1" }` + */ + fun headers(headers: Optional) = headers(headers.orElse(null)) + + /** + * The query parameters for the forwarded request. This value must be specified as a valid + * JSON object rather than a query string. + */ + fun params(params: JsonValue?) = apply { body.params(params) } /** * The query parameters for the forwarded request. This value must be specified as a valid * JSON object rather than a query string. */ - fun params(params: JsonValue) = apply { this.params = params } + fun params(params: Optional) = params(params.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -371,37 +412,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): RequestForwardingForwardParams = RequestForwardingForwardParams( - checkNotNull(method) { "`method` is required but was not set" }, - checkNotNull(route) { "`route` is required but was not set" }, - data, - headers, - params, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -410,11 +443,11 @@ constructor( return true } - return /* spotless:off */ other is RequestForwardingForwardParams && method == other.method && route == other.route && data == other.data && headers == other.headers && params == other.params && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is RequestForwardingForwardParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(method, route, data, headers, params, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "RequestForwardingForwardParams{method=$method, route=$route, data=$data, headers=$headers, params=$params, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "RequestForwardingForwardParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt index ab743f7e..cc9cd11e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardResponse.kt @@ -4,36 +4,33 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = RequestForwardingForwardResponse.Builder::class) @NoAutoDetect class RequestForwardingForwardResponse +@JsonCreator private constructor( - private val headers: JsonValue, - private val statusCode: JsonField, - private val data: JsonField, - private val request: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("headers") @ExcludeMissing private val headers: JsonValue = JsonMissing.of(), + @JsonProperty("request") + @ExcludeMissing + private val request: JsonField = JsonMissing.of(), + @JsonProperty("statusCode") + @ExcludeMissing + private val statusCode: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** - * The HTTP status code of the forwarded request’s response, exactly received from the - * underlying integration’s API. This value will be returned as an integer. - */ - fun statusCode(): Long = statusCode.getRequired("statusCode") - /** * A string representation of the HTTP response body of the forwarded request’s response * received from the underlying integration’s API. This field may be null in the case where the @@ -46,17 +43,11 @@ private constructor( */ fun request(): Request = request.getRequired("request") - /** - * The HTTP headers of the forwarded request’s response, exactly as received from the underlying - * integration’s API. - */ - @JsonProperty("headers") @ExcludeMissing fun _headers() = headers - /** * The HTTP status code of the forwarded request’s response, exactly received from the * underlying integration’s API. This value will be returned as an integer. */ - @JsonProperty("statusCode") @ExcludeMissing fun _statusCode() = statusCode + fun statusCode(): Long = statusCode.getRequired("statusCode") /** * A string representation of the HTTP response body of the forwarded request’s response @@ -65,20 +56,34 @@ private constructor( */ @JsonProperty("data") @ExcludeMissing fun _data() = data + /** + * The HTTP headers of the forwarded request’s response, exactly as received from the underlying + * integration’s API. + */ + @JsonProperty("headers") @ExcludeMissing fun _headers() = headers + /** * An object containing details of your original forwarded request, for your ease of reference. */ @JsonProperty("request") @ExcludeMissing fun _request() = request + /** + * The HTTP status code of the forwarded request’s response, exactly received from the + * underlying integration’s API. This value will be returned as an integer. + */ + @JsonProperty("statusCode") @ExcludeMissing fun _statusCode() = statusCode + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): RequestForwardingForwardResponse = apply { if (!validated) { - statusCode() data() request().validate() + statusCode() validated = true } } @@ -92,44 +97,23 @@ private constructor( class Builder { - private var headers: JsonValue = JsonMissing.of() - private var statusCode: JsonField = JsonMissing.of() private var data: JsonField = JsonMissing.of() + private var headers: JsonValue = JsonMissing.of() private var request: JsonField = JsonMissing.of() + private var statusCode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(requestForwardingForwardResponse: RequestForwardingForwardResponse) = apply { - this.headers = requestForwardingForwardResponse.headers - this.statusCode = requestForwardingForwardResponse.statusCode - this.data = requestForwardingForwardResponse.data - this.request = requestForwardingForwardResponse.request - additionalProperties(requestForwardingForwardResponse.additionalProperties) + data = requestForwardingForwardResponse.data + headers = requestForwardingForwardResponse.headers + request = requestForwardingForwardResponse.request + statusCode = requestForwardingForwardResponse.statusCode + additionalProperties = + requestForwardingForwardResponse.additionalProperties.toMutableMap() } - /** - * The HTTP headers of the forwarded request’s response, exactly as received from the - * underlying integration’s API. - */ - @JsonProperty("headers") - @ExcludeMissing - fun headers(headers: JsonValue) = apply { this.headers = headers } - - /** - * The HTTP status code of the forwarded request’s response, exactly received from the - * underlying integration’s API. This value will be returned as an integer. - */ - fun statusCode(statusCode: Long) = statusCode(JsonField.of(statusCode)) - - /** - * The HTTP status code of the forwarded request’s response, exactly received from the - * underlying integration’s API. This value will be returned as an integer. - */ - @JsonProperty("statusCode") - @ExcludeMissing - fun statusCode(statusCode: JsonField) = apply { this.statusCode = statusCode } - /** * A string representation of the HTTP response body of the forwarded request’s response * received from the underlying integration’s API. This field may be null in the case where @@ -142,10 +126,14 @@ private constructor( * received from the underlying integration’s API. This field may be null in the case where * the upstream system’s response is empty. */ - @JsonProperty("data") - @ExcludeMissing fun data(data: JsonField) = apply { this.data = data } + /** + * The HTTP headers of the forwarded request’s response, exactly as received from the + * underlying integration’s API. + */ + fun headers(headers: JsonValue) = apply { this.headers = headers } + /** * An object containing details of your original forwarded request, for your ease of * reference. @@ -156,30 +144,45 @@ private constructor( * An object containing details of your original forwarded request, for your ease of * reference. */ - @JsonProperty("request") - @ExcludeMissing fun request(request: JsonField) = apply { this.request = request } + /** + * The HTTP status code of the forwarded request’s response, exactly received from the + * underlying integration’s API. This value will be returned as an integer. + */ + fun statusCode(statusCode: Long) = statusCode(JsonField.of(statusCode)) + + /** + * The HTTP status code of the forwarded request’s response, exactly received from the + * underlying integration’s API. This value will be returned as an integer. + */ + fun statusCode(statusCode: JsonField) = apply { this.statusCode = statusCode } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): RequestForwardingForwardResponse = RequestForwardingForwardResponse( - headers, - statusCode, data, + headers, request, + statusCode, additionalProperties.toImmutable(), ) } @@ -187,19 +190,31 @@ private constructor( /** * An object containing details of your original forwarded request, for your ease of reference. */ - @JsonDeserialize(builder = Request.Builder::class) @NoAutoDetect class Request + @JsonCreator private constructor( - private val method: JsonField, - private val route: JsonField, - private val headers: JsonValue, - private val params: JsonValue, - private val data: JsonField, - private val additionalProperties: Map, + @JsonProperty("data") + @ExcludeMissing + private val data: JsonField = JsonMissing.of(), + @JsonProperty("headers") @ExcludeMissing private val headers: JsonValue = JsonMissing.of(), + @JsonProperty("method") + @ExcludeMissing + private val method: JsonField = JsonMissing.of(), + @JsonProperty("params") @ExcludeMissing private val params: JsonValue = JsonMissing.of(), + @JsonProperty("route") + @ExcludeMissing + private val route: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** + * The body that was specified for the forwarded request. If a value was not specified in + * the original request, this value will be returned as null ; otherwise, this value will + * always be returned as a string. + */ + fun data(): Optional = Optional.ofNullable(data.getNullable("data")) /** * The HTTP method that was specified for the forwarded request. Valid values include: `GET` @@ -215,16 +230,7 @@ private constructor( * the original request, this value will be returned as null ; otherwise, this value will * always be returned as a string. */ - fun data(): Optional = Optional.ofNullable(data.getNullable("data")) - - /** - * The HTTP method that was specified for the forwarded request. Valid values include: `GET` - * , `POST` , `PUT` , `DELETE` , and `PATCH`. - */ - @JsonProperty("method") @ExcludeMissing fun _method() = method - - /** The URL route path that was specified for the forwarded request. */ - @JsonProperty("route") @ExcludeMissing fun _route() = route + @JsonProperty("data") @ExcludeMissing fun _data() = data /** * The specified HTTP headers that were included in the forwarded request. If no headers @@ -232,28 +238,32 @@ private constructor( */ @JsonProperty("headers") @ExcludeMissing fun _headers() = headers + /** + * The HTTP method that was specified for the forwarded request. Valid values include: `GET` + * , `POST` , `PUT` , `DELETE` , and `PATCH`. + */ + @JsonProperty("method") @ExcludeMissing fun _method() = method + /** * The query parameters that were included in the forwarded request. If no query parameters * were specified, this will be returned as `null`. */ @JsonProperty("params") @ExcludeMissing fun _params() = params - /** - * The body that was specified for the forwarded request. If a value was not specified in - * the original request, this value will be returned as null ; otherwise, this value will - * always be returned as a string. - */ - @JsonProperty("data") @ExcludeMissing fun _data() = data + /** The URL route path that was specified for the forwarded request. */ + @JsonProperty("route") @ExcludeMissing fun _route() = route @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Request = apply { if (!validated) { + data() method() route() - data() validated = true } } @@ -267,98 +277,93 @@ private constructor( class Builder { - private var method: JsonField = JsonMissing.of() - private var route: JsonField = JsonMissing.of() + private var data: JsonField = JsonMissing.of() private var headers: JsonValue = JsonMissing.of() + private var method: JsonField = JsonMissing.of() private var params: JsonValue = JsonMissing.of() - private var data: JsonField = JsonMissing.of() + private var route: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(request: Request) = apply { - this.method = request.method - this.route = request.route - this.headers = request.headers - this.params = request.params - this.data = request.data - additionalProperties(request.additionalProperties) + data = request.data + headers = request.headers + method = request.method + params = request.params + route = request.route + additionalProperties = request.additionalProperties.toMutableMap() } /** - * The HTTP method that was specified for the forwarded request. Valid values include: - * `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. + * The body that was specified for the forwarded request. If a value was not specified + * in the original request, this value will be returned as null ; otherwise, this value + * will always be returned as a string. */ - fun method(method: String) = method(JsonField.of(method)) + fun data(data: String) = data(JsonField.of(data)) /** - * The HTTP method that was specified for the forwarded request. Valid values include: - * `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. + * The body that was specified for the forwarded request. If a value was not specified + * in the original request, this value will be returned as null ; otherwise, this value + * will always be returned as a string. */ - @JsonProperty("method") - @ExcludeMissing - fun method(method: JsonField) = apply { this.method = method } - - /** The URL route path that was specified for the forwarded request. */ - fun route(route: String) = route(JsonField.of(route)) - - /** The URL route path that was specified for the forwarded request. */ - @JsonProperty("route") - @ExcludeMissing - fun route(route: JsonField) = apply { this.route = route } + fun data(data: JsonField) = apply { this.data = data } /** * The specified HTTP headers that were included in the forwarded request. If no headers * were specified, this will be returned as `null`. */ - @JsonProperty("headers") - @ExcludeMissing fun headers(headers: JsonValue) = apply { this.headers = headers } /** - * The query parameters that were included in the forwarded request. If no query - * parameters were specified, this will be returned as `null`. + * The HTTP method that was specified for the forwarded request. Valid values include: + * `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. */ - @JsonProperty("params") - @ExcludeMissing - fun params(params: JsonValue) = apply { this.params = params } + fun method(method: String) = method(JsonField.of(method)) /** - * The body that was specified for the forwarded request. If a value was not specified - * in the original request, this value will be returned as null ; otherwise, this value - * will always be returned as a string. + * The HTTP method that was specified for the forwarded request. Valid values include: + * `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. */ - fun data(data: String) = data(JsonField.of(data)) + fun method(method: JsonField) = apply { this.method = method } /** - * The body that was specified for the forwarded request. If a value was not specified - * in the original request, this value will be returned as null ; otherwise, this value - * will always be returned as a string. + * The query parameters that were included in the forwarded request. If no query + * parameters were specified, this will be returned as `null`. */ - @JsonProperty("data") - @ExcludeMissing - fun data(data: JsonField) = apply { this.data = data } + fun params(params: JsonValue) = apply { this.params = params } + + /** The URL route path that was specified for the forwarded request. */ + fun route(route: String) = route(JsonField.of(route)) + + /** The URL route path that was specified for the forwarded request. */ + fun route(route: JsonField) = apply { this.route = route } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Request = Request( - method, - route, + data, headers, + method, params, - data, + route, additionalProperties.toImmutable(), ) } @@ -368,17 +373,17 @@ private constructor( return true } - return /* spotless:off */ other is Request && method == other.method && route == other.route && headers == other.headers && params == other.params && data == other.data && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Request && data == other.data && headers == other.headers && method == other.method && params == other.params && route == other.route && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(method, route, headers, params, data, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(data, headers, method, params, route, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Request{method=$method, route=$route, headers=$headers, params=$params, data=$data, additionalProperties=$additionalProperties}" + "Request{data=$data, headers=$headers, method=$method, params=$params, route=$route, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -386,15 +391,15 @@ private constructor( return true } - return /* spotless:off */ other is RequestForwardingForwardResponse && headers == other.headers && statusCode == other.statusCode && data == other.data && request == other.request && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is RequestForwardingForwardResponse && data == other.data && headers == other.headers && request == other.request && statusCode == other.statusCode && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(headers, statusCode, data, request, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(data, headers, request, statusCode, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "RequestForwardingForwardResponse{headers=$headers, statusCode=$statusCode, data=$data, request=$request, additionalProperties=$additionalProperties}" + "RequestForwardingForwardResponse{data=$data, headers=$headers, request=$request, statusCode=$statusCode, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index 6b1ffd95..ffdb478e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -21,97 +21,90 @@ 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 body: SandboxCompanyUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun accounts(): Optional> = Optional.ofNullable(accounts) + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(): Optional> = body.accounts() - fun departments(): Optional> = Optional.ofNullable(departments) + /** The array of company departments. */ + fun departments(): Optional> = body.departments() - fun ein(): Optional = Optional.ofNullable(ein) + /** The employer identification number. */ + fun ein(): Optional = body.ein() - fun entity(): Optional = Optional.ofNullable(entity) + /** The entity type object. */ + fun entity(): Optional = body.entity() - fun legalName(): Optional = Optional.ofNullable(legalName) + /** The legal name of the company. */ + fun legalName(): Optional = body.legalName() - fun locations(): Optional> = Optional.ofNullable(locations) + fun locations(): Optional> = body.locations() - fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail) + /** The email of the main administrator on the account. */ + fun primaryEmail(): Optional = body.primaryEmail() - fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber) + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(): Optional = body.primaryPhoneNumber() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SandboxCompanyUpdateBody { - return SandboxCompanyUpdateBody( - accounts, - departments, - ein, - entity, - legalName, - locations, - primaryEmail, - primaryPhoneNumber, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SandboxCompanyUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = SandboxCompanyUpdateBody.Builder::class) @NoAutoDetect class SandboxCompanyUpdateBody + @JsonCreator 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, + @JsonProperty("accounts") private val accounts: List?, + @JsonProperty("departments") private val departments: List?, + @JsonProperty("ein") private val ein: String?, + @JsonProperty("entity") private val entity: Entity?, + @JsonProperty("legal_name") private val legalName: String?, + @JsonProperty("locations") private val locations: List?, + @JsonProperty("primary_email") private val primaryEmail: String?, + @JsonProperty("primary_phone_number") private val primaryPhoneNumber: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** An array of bank account objects associated with the payroll/HRIS system. */ - @JsonProperty("accounts") fun accounts(): List? = accounts + @JsonProperty("accounts") + fun accounts(): Optional> = Optional.ofNullable(accounts) /** The array of company departments. */ - @JsonProperty("departments") fun departments(): List? = departments + @JsonProperty("departments") + fun departments(): Optional> = Optional.ofNullable(departments) /** The employer identification number. */ - @JsonProperty("ein") fun ein(): String? = ein + @JsonProperty("ein") fun ein(): Optional = Optional.ofNullable(ein) /** The entity type object. */ - @JsonProperty("entity") fun entity(): Entity? = entity + @JsonProperty("entity") fun entity(): Optional = Optional.ofNullable(entity) /** The legal name of the company. */ - @JsonProperty("legal_name") fun legalName(): String? = legalName + @JsonProperty("legal_name") + fun legalName(): Optional = Optional.ofNullable(legalName) - @JsonProperty("locations") fun locations(): List? = locations + @JsonProperty("locations") + fun locations(): Optional> = Optional.ofNullable(locations) /** The email of the main administrator on the account. */ - @JsonProperty("primary_email") fun primaryEmail(): String? = primaryEmail + @JsonProperty("primary_email") + fun primaryEmail(): Optional = Optional.ofNullable(primaryEmail) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ - @JsonProperty("primary_phone_number") fun primaryPhoneNumber(): String? = primaryPhoneNumber + @JsonProperty("primary_phone_number") + fun primaryPhoneNumber(): Optional = Optional.ofNullable(primaryPhoneNumber) @JsonAnyGetter @ExcludeMissing @@ -126,76 +119,119 @@ constructor( class Builder { - private var accounts: List? = null - private var departments: List? = null + private var accounts: MutableList? = null + private var departments: MutableList? = null private var ein: String? = null private var entity: Entity? = null private var legalName: String? = null - private var locations: List? = null + private var locations: MutableList? = 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) + accounts = sandboxCompanyUpdateBody.accounts?.toMutableList() + departments = sandboxCompanyUpdateBody.departments?.toMutableList() + ein = sandboxCompanyUpdateBody.ein + entity = sandboxCompanyUpdateBody.entity + legalName = sandboxCompanyUpdateBody.legalName + locations = sandboxCompanyUpdateBody.locations?.toMutableList() + primaryEmail = sandboxCompanyUpdateBody.primaryEmail + primaryPhoneNumber = sandboxCompanyUpdateBody.primaryPhoneNumber + additionalProperties = sandboxCompanyUpdateBody.additionalProperties.toMutableMap() } /** An array of bank account objects associated with the payroll/HRIS system. */ - @JsonProperty("accounts") - fun accounts(accounts: List) = apply { this.accounts = accounts } + fun accounts(accounts: List?) = apply { + this.accounts = accounts?.toMutableList() + } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: Optional>) = accounts(accounts.orElse(null)) + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun addAccount(account: Account) = apply { + accounts = (accounts ?: mutableListOf()).apply { add(account) } + } /** The array of company departments. */ - @JsonProperty("departments") - fun departments(departments: List) = apply { - this.departments = departments + fun departments(departments: List?) = apply { + this.departments = departments?.toMutableList() + } + + /** The array of company departments. */ + fun departments(departments: Optional>) = + departments(departments.orElse(null)) + + /** The array of company departments. */ + fun addDepartment(department: Department) = apply { + departments = (departments ?: mutableListOf()).apply { add(department) } } /** The employer identification number. */ - @JsonProperty("ein") fun ein(ein: String) = apply { this.ein = ein } + fun ein(ein: String?) = apply { this.ein = ein } + + /** The employer identification number. */ + fun ein(ein: Optional) = ein(ein.orElse(null)) + + /** The entity type object. */ + fun entity(entity: Entity?) = apply { this.entity = entity } /** The entity type object. */ - @JsonProperty("entity") fun entity(entity: Entity) = apply { this.entity = entity } + fun entity(entity: Optional) = entity(entity.orElse(null)) /** The legal name of the company. */ - @JsonProperty("legal_name") - fun legalName(legalName: String) = apply { this.legalName = legalName } + fun legalName(legalName: String?) = apply { this.legalName = legalName } - @JsonProperty("locations") - fun locations(locations: List) = apply { this.locations = locations } + /** The legal name of the company. */ + fun legalName(legalName: Optional) = legalName(legalName.orElse(null)) + + fun locations(locations: List?) = apply { + this.locations = locations?.toMutableList() + } + + fun locations(locations: Optional>) = locations(locations.orElse(null)) + + fun addLocation(location: Location) = apply { + locations = (locations ?: mutableListOf()).apply { add(location) } + } + + /** The email of the main administrator on the account. */ + fun primaryEmail(primaryEmail: String?) = apply { this.primaryEmail = primaryEmail } /** The email of the main administrator on the account. */ - @JsonProperty("primary_email") - fun primaryEmail(primaryEmail: String) = apply { this.primaryEmail = primaryEmail } + fun primaryEmail(primaryEmail: Optional) = + primaryEmail(primaryEmail.orElse(null)) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ - @JsonProperty("primary_phone_number") - fun primaryPhoneNumber(primaryPhoneNumber: String) = apply { + fun primaryPhoneNumber(primaryPhoneNumber: String?) = apply { this.primaryPhoneNumber = primaryPhoneNumber } + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(primaryPhoneNumber: Optional) = + primaryPhoneNumber(primaryPhoneNumber.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxCompanyUpdateBody = SandboxCompanyUpdateBody( accounts?.toImmutable(), @@ -238,76 +274,75 @@ constructor( @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 body: SandboxCompanyUpdateBody.Builder = SandboxCompanyUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxCompanyUpdateParams: SandboxCompanyUpdateParams) = apply { - accounts = sandboxCompanyUpdateParams.accounts?.toMutableList() ?: mutableListOf() - departments = sandboxCompanyUpdateParams.departments?.toMutableList() ?: mutableListOf() - ein = sandboxCompanyUpdateParams.ein - entity = sandboxCompanyUpdateParams.entity - legalName = sandboxCompanyUpdateParams.legalName - locations = sandboxCompanyUpdateParams.locations?.toMutableList() ?: mutableListOf() - primaryEmail = sandboxCompanyUpdateParams.primaryEmail - primaryPhoneNumber = sandboxCompanyUpdateParams.primaryPhoneNumber + body = sandboxCompanyUpdateParams.body.toBuilder() additionalHeaders = sandboxCompanyUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxCompanyUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxCompanyUpdateParams.additionalBodyProperties.toMutableMap() } /** An array of bank account objects associated with the payroll/HRIS system. */ - fun accounts(accounts: List) = apply { - this.accounts.clear() - this.accounts.addAll(accounts) - } + fun accounts(accounts: List?) = apply { body.accounts(accounts) } + + /** An array of bank account objects associated with the payroll/HRIS system. */ + fun accounts(accounts: Optional>) = accounts(accounts.orElse(null)) /** An array of bank account objects associated with the payroll/HRIS system. */ - fun addAccount(account: Account) = apply { this.accounts.add(account) } + fun addAccount(account: Account) = apply { body.addAccount(account) } /** The array of company departments. */ - fun departments(departments: List) = apply { - this.departments.clear() - this.departments.addAll(departments) - } + fun departments(departments: List?) = apply { body.departments(departments) } + + /** The array of company departments. */ + fun departments(departments: Optional>) = + departments(departments.orElse(null)) /** The array of company departments. */ - fun addDepartment(department: Department) = apply { this.departments.add(department) } + fun addDepartment(department: Department) = apply { body.addDepartment(department) } + + /** The employer identification number. */ + fun ein(ein: String?) = apply { body.ein(ein) } /** The employer identification number. */ - fun ein(ein: String) = apply { this.ein = ein } + fun ein(ein: Optional) = ein(ein.orElse(null)) /** The entity type object. */ - fun entity(entity: Entity) = apply { this.entity = entity } + fun entity(entity: Entity?) = apply { body.entity(entity) } + + /** The entity type object. */ + fun entity(entity: Optional) = entity(entity.orElse(null)) /** The legal name of the company. */ - fun legalName(legalName: String) = apply { this.legalName = legalName } + fun legalName(legalName: String?) = apply { body.legalName(legalName) } - fun locations(locations: List) = apply { - this.locations.clear() - this.locations.addAll(locations) - } + /** The legal name of the company. */ + fun legalName(legalName: Optional) = legalName(legalName.orElse(null)) - fun addLocation(location: Location) = apply { this.locations.add(location) } + fun locations(locations: List?) = apply { body.locations(locations) } + + fun locations(locations: Optional>) = locations(locations.orElse(null)) + + fun addLocation(location: Location) = apply { body.addLocation(location) } /** The email of the main administrator on the account. */ - fun primaryEmail(primaryEmail: String) = apply { this.primaryEmail = primaryEmail } + fun primaryEmail(primaryEmail: String?) = apply { body.primaryEmail(primaryEmail) } + + /** The email of the main administrator on the account. */ + fun primaryEmail(primaryEmail: Optional) = primaryEmail(primaryEmail.orElse(null)) /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ - fun primaryPhoneNumber(primaryPhoneNumber: String) = apply { - this.primaryPhoneNumber = primaryPhoneNumber + fun primaryPhoneNumber(primaryPhoneNumber: String?) = apply { + body.primaryPhoneNumber(primaryPhoneNumber) } + /** The phone number of the main administrator on the account. Format: `XXXXXXXXXX` */ + fun primaryPhoneNumber(primaryPhoneNumber: Optional) = + primaryPhoneNumber(primaryPhoneNumber.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -407,71 +442,66 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxCompanyUpdateParams = SandboxCompanyUpdateParams( - accounts.toImmutable().ifEmpty { null }, - departments.toImmutable().ifEmpty { null }, - ein, - entity, - legalName, - locations.toImmutable().ifEmpty { null }, - primaryEmail, - primaryPhoneNumber, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Account.Builder::class) @NoAutoDetect class Account + @JsonCreator 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, + @JsonProperty("account_name") private val accountName: String?, + @JsonProperty("account_number") private val accountNumber: String?, + @JsonProperty("account_type") private val accountType: AccountType?, + @JsonProperty("institution_name") private val institutionName: String?, + @JsonProperty("routing_number") private val routingNumber: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** - * 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 + @JsonProperty("account_name") + fun accountName(): Optional = Optional.ofNullable(accountName) - /** Name of the banking institution. */ - @JsonProperty("institution_name") fun institutionName(): String? = institutionName + /** 10-12 digit number to specify the bank account */ + @JsonProperty("account_number") + fun accountNumber(): Optional = Optional.ofNullable(accountNumber) /** The type of bank account. */ - @JsonProperty("account_type") fun accountType(): AccountType? = accountType + @JsonProperty("account_type") + fun accountType(): Optional = Optional.ofNullable(accountType) - /** 10-12 digit number to specify the bank account */ - @JsonProperty("account_number") fun accountNumber(): String? = accountNumber + /** Name of the banking institution. */ + @JsonProperty("institution_name") + fun institutionName(): Optional = Optional.ofNullable(institutionName) + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was opened. + */ + @JsonProperty("routing_number") + fun routingNumber(): Optional = Optional.ofNullable(routingNumber) @JsonAnyGetter @ExcludeMissing @@ -486,69 +516,91 @@ constructor( 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 accountType: AccountType? = null + private var institutionName: String? = null + private var routingNumber: 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) + accountName = account.accountName + accountNumber = account.accountNumber + accountType = account.accountType + institutionName = account.institutionName + routingNumber = account.routingNumber + additionalProperties = account.additionalProperties.toMutableMap() } - /** - * 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. */ + fun accountName(accountName: String?) = apply { this.accountName = accountName } /** The name of the bank associated in the payroll/HRIS system. */ - @JsonProperty("account_name") - fun accountName(accountName: String) = apply { this.accountName = accountName } + fun accountName(accountName: Optional) = accountName(accountName.orElse(null)) + + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: String?) = apply { this.accountNumber = accountNumber } + + /** 10-12 digit number to specify the bank account */ + fun accountNumber(accountNumber: Optional) = + accountNumber(accountNumber.orElse(null)) + + /** The type of bank account. */ + fun accountType(accountType: AccountType?) = apply { this.accountType = accountType } + + /** The type of bank account. */ + fun accountType(accountType: Optional) = + accountType(accountType.orElse(null)) /** Name of the banking institution. */ - @JsonProperty("institution_name") - fun institutionName(institutionName: String) = apply { + fun institutionName(institutionName: String?) = apply { this.institutionName = institutionName } - /** The type of bank account. */ - @JsonProperty("account_type") - fun accountType(accountType: AccountType) = apply { this.accountType = accountType } + /** Name of the banking institution. */ + fun institutionName(institutionName: Optional) = + institutionName(institutionName.orElse(null)) - /** 10-12 digit number to specify the bank account */ - @JsonProperty("account_number") - fun accountNumber(accountNumber: String) = apply { this.accountNumber = accountNumber } + /** + * A nine-digit code that's based on the U.S. Bank location where your account was + * opened. + */ + fun routingNumber(routingNumber: String?) = apply { this.routingNumber = routingNumber } + + /** + * A nine-digit code that's based on the U.S. Bank location where your account was + * opened. + */ + fun routingNumber(routingNumber: Optional) = + routingNumber(routingNumber.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Account = Account( - routingNumber, accountName, - institutionName, - accountType, accountNumber, + accountType, + institutionName, + routingNumber, additionalProperties.toImmutable(), ) } @@ -615,33 +667,34 @@ constructor( return true } - return /* spotless:off */ other is Account && routingNumber == other.routingNumber && accountName == other.accountName && institutionName == other.institutionName && accountType == other.accountType && accountNumber == other.accountNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Account && accountName == other.accountName && accountNumber == other.accountNumber && accountType == other.accountType && institutionName == other.institutionName && routingNumber == other.routingNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(routingNumber, accountName, institutionName, accountType, accountNumber, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(accountName, accountNumber, accountType, institutionName, routingNumber, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Account{routingNumber=$routingNumber, accountName=$accountName, institutionName=$institutionName, accountType=$accountType, accountNumber=$accountNumber, additionalProperties=$additionalProperties}" + "Account{accountName=$accountName, accountNumber=$accountNumber, accountType=$accountType, institutionName=$institutionName, routingNumber=$routingNumber, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: String?, - private val parent: Parent?, - private val additionalProperties: Map, + @JsonProperty("name") private val name: String?, + @JsonProperty("parent") private val parent: Parent?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The department name. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) /** The parent department, if present. */ - @JsonProperty("parent") fun parent(): Parent? = parent + @JsonProperty("parent") fun parent(): Optional = Optional.ofNullable(parent) @JsonAnyGetter @ExcludeMissing @@ -662,31 +715,42 @@ constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - this.parent = department.parent - additionalProperties(department.additionalProperties) + name = department.name + parent = department.parent + additionalProperties = department.additionalProperties.toMutableMap() } /** The department name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + /** The department name. */ + fun name(name: Optional) = name(name.orElse(null)) + + /** The parent department, if present. */ + fun parent(parent: Parent?) = apply { this.parent = parent } /** The parent department, if present. */ - @JsonProperty("parent") fun parent(parent: Parent) = apply { this.parent = parent } + fun parent(parent: Optional) = parent(parent.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department( name, @@ -696,16 +760,17 @@ constructor( } /** The parent department, if present. */ - @JsonDeserialize(builder = Parent.Builder::class) @NoAutoDetect class Parent + @JsonCreator private constructor( - private val name: String?, - private val additionalProperties: Map, + @JsonProperty("name") private val name: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The parent department's name. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) @JsonAnyGetter @ExcludeMissing @@ -725,21 +790,23 @@ constructor( @JvmSynthetic internal fun from(parent: Parent) = apply { - this.name = parent.name - additionalProperties(parent.additionalProperties) + name = parent.name + additionalProperties = parent.additionalProperties.toMutableMap() } /** The parent department's name. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + /** The parent department's name. */ + fun name(name: Optional) = name(name.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -747,6 +814,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Parent = Parent(name, additionalProperties.toImmutable()) } @@ -787,20 +862,21 @@ constructor( } /** The entity type object. */ - @JsonDeserialize(builder = Entity.Builder::class) @NoAutoDetect class Entity + @JsonCreator private constructor( - private val type: Type?, - private val subtype: Subtype?, - private val additionalProperties: Map, + @JsonProperty("subtype") private val subtype: Subtype?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** 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 + @JsonProperty("subtype") fun subtype(): Optional = Optional.ofNullable(subtype) + + /** The tax payer type of the company. */ + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -815,42 +891,52 @@ constructor( class Builder { - private var type: Type? = null private var subtype: Subtype? = null + private var type: Type? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(entity: Entity) = apply { - this.type = entity.type - this.subtype = entity.subtype - additionalProperties(entity.additionalProperties) + subtype = entity.subtype + type = entity.type + additionalProperties = entity.additionalProperties.toMutableMap() } - /** The tax payer type of the company. */ - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + /** The tax payer subtype of the company. */ + fun subtype(subtype: Subtype?) = apply { this.subtype = subtype } /** The tax payer subtype of the company. */ - @JsonProperty("subtype") - fun subtype(subtype: Subtype) = apply { this.subtype = subtype } + fun subtype(subtype: Optional) = subtype(subtype.orElse(null)) + + /** The tax payer type of the company. */ + fun type(type: Type?) = apply { this.type = type } + + /** The tax payer type of the company. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Entity = Entity( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -1010,17 +1096,17 @@ constructor( return true } - return /* spotless:off */ other is Entity && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Entity && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Entity{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Entity{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1028,11 +1114,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxCompanyUpdateParams && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxCompanyUpdateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(accounts, departments, ein, entity, legalName, locations, primaryEmail, primaryPhoneNumber, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxCompanyUpdateParams{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxCompanyUpdateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index 67ef1401..e4c8a567 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -21,68 +21,63 @@ 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 body: SandboxConnectionAccountCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun companyId(): String = companyId + fun companyId(): String = body.companyId() - fun providerId(): String = providerId + /** The provider associated with the `access_token` */ + fun providerId(): String = body.providerId() - fun authenticationType(): Optional = Optional.ofNullable(authenticationType) + fun authenticationType(): Optional = body.authenticationType() - fun products(): Optional> = Optional.ofNullable(products) + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun products(): Optional> = body.products() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SandboxConnectionAccountCreateBody { - return SandboxConnectionAccountCreateBody( - companyId, - providerId, - authenticationType, - products, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SandboxConnectionAccountCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = SandboxConnectionAccountCreateBody.Builder::class) @NoAutoDetect class SandboxConnectionAccountCreateBody + @JsonCreator internal constructor( - private val companyId: String?, - private val providerId: String?, - private val authenticationType: AuthenticationType?, - private val products: List?, - private val additionalProperties: Map, + @JsonProperty("company_id") private val companyId: String, + @JsonProperty("provider_id") private val providerId: String, + @JsonProperty("authentication_type") private val authenticationType: AuthenticationType?, + @JsonProperty("products") private val products: List?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("company_id") fun companyId(): String? = companyId + @JsonProperty("company_id") fun companyId(): String = companyId /** The provider associated with the `access_token` */ - @JsonProperty("provider_id") fun providerId(): String? = providerId + @JsonProperty("provider_id") fun providerId(): String = providerId @JsonProperty("authentication_type") - fun authenticationType(): AuthenticationType? = authenticationType + fun authenticationType(): Optional = + Optional.ofNullable(authenticationType) /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, * `individual`) */ - @JsonProperty("products") fun products(): List? = products + @JsonProperty("products") + fun products(): Optional> = Optional.ofNullable(products) @JsonAnyGetter @ExcludeMissing @@ -100,53 +95,74 @@ constructor( private var companyId: String? = null private var providerId: String? = null private var authenticationType: AuthenticationType? = null - private var products: List? = null + private var products: MutableList? = 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) + companyId = sandboxConnectionAccountCreateBody.companyId + providerId = sandboxConnectionAccountCreateBody.providerId + authenticationType = sandboxConnectionAccountCreateBody.authenticationType + products = sandboxConnectionAccountCreateBody.products?.toMutableList() + additionalProperties = + sandboxConnectionAccountCreateBody.additionalProperties.toMutableMap() } - @JsonProperty("company_id") fun companyId(companyId: String) = apply { this.companyId = companyId } /** The provider associated with the `access_token` */ - @JsonProperty("provider_id") fun providerId(providerId: String) = apply { this.providerId = providerId } - @JsonProperty("authentication_type") - fun authenticationType(authenticationType: AuthenticationType) = apply { + fun authenticationType(authenticationType: AuthenticationType?) = apply { this.authenticationType = authenticationType } + fun authenticationType(authenticationType: Optional) = + authenticationType(authenticationType.orElse(null)) + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun products(products: List?) = apply { + this.products = products?.toMutableList() + } + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun products(products: Optional>) = products(products.orElse(null)) + /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, * `individual`) */ - @JsonProperty("products") - fun products(products: List) = apply { this.products = products } + fun addProduct(product: String) = apply { + products = (products ?: mutableListOf()).apply { add(product) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxConnectionAccountCreateBody = SandboxConnectionAccountCreateBody( checkNotNull(companyId) { "`companyId` is required but was not set" }, @@ -185,53 +201,50 @@ constructor( @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 body: SandboxConnectionAccountCreateBody.Builder = + SandboxConnectionAccountCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( sandboxConnectionAccountCreateParams: SandboxConnectionAccountCreateParams ) = apply { - companyId = sandboxConnectionAccountCreateParams.companyId - providerId = sandboxConnectionAccountCreateParams.providerId - authenticationType = sandboxConnectionAccountCreateParams.authenticationType - products = - sandboxConnectionAccountCreateParams.products?.toMutableList() ?: mutableListOf() + body = sandboxConnectionAccountCreateParams.body.toBuilder() additionalHeaders = sandboxConnectionAccountCreateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxConnectionAccountCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxConnectionAccountCreateParams.additionalBodyProperties.toMutableMap() } - fun companyId(companyId: String) = apply { this.companyId = companyId } + fun companyId(companyId: String) = apply { body.companyId(companyId) } /** The provider associated with the `access_token` */ - fun providerId(providerId: String) = apply { this.providerId = providerId } + fun providerId(providerId: String) = apply { body.providerId(providerId) } - fun authenticationType(authenticationType: AuthenticationType) = apply { - this.authenticationType = authenticationType + fun authenticationType(authenticationType: AuthenticationType?) = apply { + body.authenticationType(authenticationType) } + fun authenticationType(authenticationType: Optional) = + authenticationType(authenticationType.orElse(null)) + /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, * `individual`) */ - fun products(products: List) = apply { - this.products.clear() - this.products.addAll(products) - } + fun products(products: List?) = apply { body.products(products) } /** * Optional, defaults to Organization products (`company`, `directory`, `employment`, * `individual`) */ - fun addProduct(product: String) = apply { this.products.add(product) } + fun products(products: Optional>) = products(products.orElse(null)) + + /** + * Optional, defaults to Organization products (`company`, `directory`, `employment`, + * `individual`) + */ + fun addProduct(product: String) = apply { body.addProduct(product) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -332,36 +345,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxConnectionAccountCreateParams = SandboxConnectionAccountCreateParams( - checkNotNull(companyId) { "`companyId` is required but was not set" }, - checkNotNull(providerId) { "`providerId` is required but was not set" }, - authenticationType, - products.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -439,11 +445,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxConnectionAccountCreateParams && companyId == other.companyId && providerId == other.providerId && authenticationType == other.authenticationType && products == other.products && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxConnectionAccountCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(companyId, providerId, authenticationType, products, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxConnectionAccountCreateParams{companyId=$companyId, providerId=$providerId, authenticationType=$authenticationType, products=$products, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxConnectionAccountCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 0d332a03..bc570952 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -4,52 +4,51 @@ 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.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional class SandboxConnectionAccountUpdateParams constructor( - private val connectionStatus: ConnectionStatusType?, + private val body: SandboxConnectionAccountUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun connectionStatus(): Optional = Optional.ofNullable(connectionStatus) + fun connectionStatus(): Optional = body.connectionStatus() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SandboxConnectionAccountUpdateBody { - return SandboxConnectionAccountUpdateBody(connectionStatus, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): SandboxConnectionAccountUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = SandboxConnectionAccountUpdateBody.Builder::class) @NoAutoDetect class SandboxConnectionAccountUpdateBody + @JsonCreator internal constructor( - private val connectionStatus: ConnectionStatusType?, - private val additionalProperties: Map, + @JsonProperty("connection_status") private val connectionStatus: ConnectionStatusType?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonProperty("connection_status") - fun connectionStatus(): ConnectionStatusType? = connectionStatus + fun connectionStatus(): Optional = + Optional.ofNullable(connectionStatus) @JsonAnyGetter @ExcludeMissing @@ -71,29 +70,37 @@ constructor( internal fun from( sandboxConnectionAccountUpdateBody: SandboxConnectionAccountUpdateBody ) = apply { - this.connectionStatus = sandboxConnectionAccountUpdateBody.connectionStatus - additionalProperties(sandboxConnectionAccountUpdateBody.additionalProperties) + connectionStatus = sandboxConnectionAccountUpdateBody.connectionStatus + additionalProperties = + sandboxConnectionAccountUpdateBody.additionalProperties.toMutableMap() } - @JsonProperty("connection_status") - fun connectionStatus(connectionStatus: ConnectionStatusType) = apply { + fun connectionStatus(connectionStatus: ConnectionStatusType?) = apply { this.connectionStatus = connectionStatus } + fun connectionStatus(connectionStatus: Optional) = + connectionStatus(connectionStatus.orElse(null)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxConnectionAccountUpdateBody = SandboxConnectionAccountUpdateBody( connectionStatus, @@ -129,27 +136,28 @@ constructor( @NoAutoDetect class Builder { - private var connectionStatus: ConnectionStatusType? = null + private var body: SandboxConnectionAccountUpdateBody.Builder = + SandboxConnectionAccountUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( sandboxConnectionAccountUpdateParams: SandboxConnectionAccountUpdateParams ) = apply { - connectionStatus = sandboxConnectionAccountUpdateParams.connectionStatus + body = sandboxConnectionAccountUpdateParams.body.toBuilder() additionalHeaders = sandboxConnectionAccountUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxConnectionAccountUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxConnectionAccountUpdateParams.additionalBodyProperties.toMutableMap() } - fun connectionStatus(connectionStatus: ConnectionStatusType) = apply { - this.connectionStatus = connectionStatus + fun connectionStatus(connectionStatus: ConnectionStatusType?) = apply { + body.connectionStatus(connectionStatus) } + fun connectionStatus(connectionStatus: Optional) = + connectionStatus(connectionStatus.orElse(null)) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -249,33 +257,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxConnectionAccountUpdateParams = SandboxConnectionAccountUpdateParams( - connectionStatus, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -284,11 +288,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxConnectionAccountUpdateParams && connectionStatus == other.connectionStatus && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxConnectionAccountUpdateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(connectionStatus, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxConnectionAccountUpdateParams{connectionStatus=$connectionStatus, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxConnectionAccountUpdateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index 21767bea..62fe40d1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -21,69 +21,66 @@ import java.util.Optional class SandboxConnectionCreateParams constructor( - private val providerId: String, - private val authenticationType: AuthenticationType?, - private val employeeSize: Long?, - private val products: List?, + private val body: SandboxConnectionCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun providerId(): String = providerId + /** The provider associated with the connection */ + fun providerId(): String = body.providerId() - fun authenticationType(): Optional = Optional.ofNullable(authenticationType) + fun authenticationType(): Optional = body.authenticationType() - fun employeeSize(): Optional = Optional.ofNullable(employeeSize) + /** + * Optional: the size of the employer to be created with this connection. Defaults to 20. Note + * that if this is higher than 100, historical payroll data will not be generated, and instead + * only one pay period will be created. + */ + fun employeeSize(): Optional = body.employeeSize() - fun products(): Optional> = Optional.ofNullable(products) + fun products(): Optional> = body.products() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SandboxConnectionCreateBody { - return SandboxConnectionCreateBody( - providerId, - authenticationType, - employeeSize, - products, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SandboxConnectionCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = SandboxConnectionCreateBody.Builder::class) @NoAutoDetect class SandboxConnectionCreateBody + @JsonCreator internal constructor( - private val providerId: String?, - private val authenticationType: AuthenticationType?, - private val employeeSize: Long?, - private val products: List?, - private val additionalProperties: Map, + @JsonProperty("provider_id") private val providerId: String, + @JsonProperty("authentication_type") private val authenticationType: AuthenticationType?, + @JsonProperty("employee_size") private val employeeSize: Long?, + @JsonProperty("products") private val products: List?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The provider associated with the connection */ - @JsonProperty("provider_id") fun providerId(): String? = providerId + @JsonProperty("provider_id") fun providerId(): String = providerId @JsonProperty("authentication_type") - fun authenticationType(): AuthenticationType? = authenticationType + fun authenticationType(): Optional = + Optional.ofNullable(authenticationType) /** * Optional: the size of the employer to be created with this connection. Defaults to 20. * Note that if this is higher than 100, historical payroll data will not be generated, and * instead only one pay period will be created. */ - @JsonProperty("employee_size") fun employeeSize(): Long? = employeeSize + @JsonProperty("employee_size") + fun employeeSize(): Optional = Optional.ofNullable(employeeSize) - @JsonProperty("products") fun products(): List? = products + @JsonProperty("products") + fun products(): Optional> = Optional.ofNullable(products) @JsonAnyGetter @ExcludeMissing @@ -101,52 +98,81 @@ constructor( private var providerId: String? = null private var authenticationType: AuthenticationType? = null private var employeeSize: Long? = null - private var products: List? = null + private var products: MutableList? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxConnectionCreateBody: SandboxConnectionCreateBody) = apply { - this.providerId = sandboxConnectionCreateBody.providerId - this.authenticationType = sandboxConnectionCreateBody.authenticationType - this.employeeSize = sandboxConnectionCreateBody.employeeSize - this.products = sandboxConnectionCreateBody.products - additionalProperties(sandboxConnectionCreateBody.additionalProperties) + providerId = sandboxConnectionCreateBody.providerId + authenticationType = sandboxConnectionCreateBody.authenticationType + employeeSize = sandboxConnectionCreateBody.employeeSize + products = sandboxConnectionCreateBody.products?.toMutableList() + additionalProperties = + sandboxConnectionCreateBody.additionalProperties.toMutableMap() } /** The provider associated with the connection */ - @JsonProperty("provider_id") fun providerId(providerId: String) = apply { this.providerId = providerId } - @JsonProperty("authentication_type") - fun authenticationType(authenticationType: AuthenticationType) = apply { + fun authenticationType(authenticationType: AuthenticationType?) = apply { this.authenticationType = authenticationType } + fun authenticationType(authenticationType: Optional) = + authenticationType(authenticationType.orElse(null)) + + /** + * Optional: the size of the employer to be created with this connection. Defaults + * to 20. Note that if this is higher than 100, historical payroll data will not be + * generated, and instead only one pay period will be created. + */ + fun employeeSize(employeeSize: Long?) = apply { this.employeeSize = employeeSize } + /** * Optional: the size of the employer to be created with this connection. Defaults * to 20. Note that if this is higher than 100, historical payroll data will not be * generated, and instead only one pay period will be created. */ - @JsonProperty("employee_size") - fun employeeSize(employeeSize: Long) = apply { this.employeeSize = employeeSize } + fun employeeSize(employeeSize: Long) = employeeSize(employeeSize as Long?) - @JsonProperty("products") - fun products(products: List) = apply { this.products = products } + /** + * Optional: the size of the employer to be created with this connection. Defaults + * to 20. Note that if this is higher than 100, historical payroll data will not be + * generated, and instead only one pay period will be created. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun employeeSize(employeeSize: Optional) = + employeeSize(employeeSize.orElse(null) as Long?) + + fun products(products: List?) = apply { + this.products = products?.toMutableList() + } + + fun products(products: Optional>) = products(products.orElse(null)) + + fun addProduct(product: String) = apply { + products = (products ?: mutableListOf()).apply { add(product) } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxConnectionCreateBody = SandboxConnectionCreateBody( checkNotNull(providerId) { "`providerId` is required but was not set" }, @@ -185,46 +211,56 @@ constructor( @NoAutoDetect class Builder { - private var providerId: String? = null - private var authenticationType: AuthenticationType? = null - private var employeeSize: Long? = null - private var products: MutableList = mutableListOf() + private var body: SandboxConnectionCreateBody.Builder = + SandboxConnectionCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxConnectionCreateParams: SandboxConnectionCreateParams) = apply { - providerId = sandboxConnectionCreateParams.providerId - authenticationType = sandboxConnectionCreateParams.authenticationType - employeeSize = sandboxConnectionCreateParams.employeeSize - products = sandboxConnectionCreateParams.products?.toMutableList() ?: mutableListOf() + body = sandboxConnectionCreateParams.body.toBuilder() additionalHeaders = sandboxConnectionCreateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxConnectionCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxConnectionCreateParams.additionalBodyProperties.toMutableMap() } /** The provider associated with the connection */ - fun providerId(providerId: String) = apply { this.providerId = providerId } + fun providerId(providerId: String) = apply { body.providerId(providerId) } - fun authenticationType(authenticationType: AuthenticationType) = apply { - this.authenticationType = authenticationType + fun authenticationType(authenticationType: AuthenticationType?) = apply { + body.authenticationType(authenticationType) } + fun authenticationType(authenticationType: Optional) = + authenticationType(authenticationType.orElse(null)) + /** * Optional: the size of the employer to be created with this connection. Defaults to 20. * Note that if this is higher than 100, historical payroll data will not be generated, and * instead only one pay period will be created. */ - fun employeeSize(employeeSize: Long) = apply { this.employeeSize = employeeSize } + fun employeeSize(employeeSize: Long?) = apply { body.employeeSize(employeeSize) } - fun products(products: List) = apply { - this.products.clear() - this.products.addAll(products) - } + /** + * Optional: the size of the employer to be created with this connection. Defaults to 20. + * Note that if this is higher than 100, historical payroll data will not be generated, and + * instead only one pay period will be created. + */ + fun employeeSize(employeeSize: Long) = employeeSize(employeeSize as Long?) + + /** + * Optional: the size of the employer to be created with this connection. Defaults to 20. + * Note that if this is higher than 100, historical payroll data will not be generated, and + * instead only one pay period will be created. + */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun employeeSize(employeeSize: Optional) = + employeeSize(employeeSize.orElse(null) as Long?) + + fun products(products: List?) = apply { body.products(products) } - fun addProduct(product: String) = apply { this.products.add(product) } + fun products(products: Optional>) = products(products.orElse(null)) + + fun addProduct(product: String) = apply { body.addProduct(product) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -325,36 +361,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxConnectionCreateParams = SandboxConnectionCreateParams( - checkNotNull(providerId) { "`providerId` is required but was not set" }, - authenticationType, - employeeSize, - products.toImmutable().ifEmpty { null }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -432,11 +461,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxConnectionCreateParams && providerId == other.providerId && authenticationType == other.authenticationType && employeeSize == other.employeeSize && products == other.products && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxConnectionCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(providerId, authenticationType, employeeSize, products, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxConnectionCreateParams{providerId=$providerId, authenticationType=$authenticationType, employeeSize=$employeeSize, products=$products, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxConnectionCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index ad31e5b4..92349133 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,9 +13,11 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects +import java.util.Optional class SandboxDirectoryCreateParams constructor( @@ -25,79 +26,22 @@ constructor( private val additionalQueryParams: QueryParams, ) { + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ fun body(): List = body fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic - internal fun getBody(): List { - return body - } + @JvmSynthetic internal fun getBody(): List = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - /** - * 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?, - ) { - - /** - * Array of individuals to create. Takes all combined fields from `/individual` and - * `/employment` endpoints. All fields are optional. - */ - @JsonProperty("body") fun body(): List? = body - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - class Builder { - - private var body: List? = null - - @JvmSynthetic - internal fun from(sandboxDirectoryCreateBody: SandboxDirectoryCreateBody) = apply { - this.body = sandboxDirectoryCreateBody.body - } - - /** - * 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 } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is SandboxDirectoryCreateBody && body == other.body /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(body) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = "SandboxDirectoryCreateBody{body=$body}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -108,7 +52,7 @@ constructor( @NoAutoDetect class Builder { - private var body: MutableList = mutableListOf() + private var body: MutableList? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -123,16 +67,15 @@ constructor( * 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) - } + fun body(body: List) = apply { this.body = body.toMutableList() } /** * Array of individuals to create. Takes all combined fields from `/individual` and * `/employment` endpoints. All fields are optional. */ - fun addBody(body: IndividualOrEmployment) = apply { this.body.add(body) } + fun addBody(body: IndividualOrEmployment) = apply { + this.body = (this.body ?: mutableListOf()).apply { add(body) } + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -234,134 +177,149 @@ constructor( fun build(): SandboxDirectoryCreateParams = SandboxDirectoryCreateParams( - body.toImmutable(), + checkNotNull(body) { "`body` is required but was not set" }.toImmutable(), additionalHeaders.build(), additionalQueryParams.build(), ) } - @JsonDeserialize(builder = IndividualOrEmployment.Builder::class) @NoAutoDetect class IndividualOrEmployment + @JsonCreator 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 latestRehireDate: String?, - private val isActive: Boolean?, - private val employmentStatus: EmploymentStatus?, - 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, + @JsonProperty("class_code") private val classCode: String?, + @JsonProperty("custom_fields") private val customFields: List?, + @JsonProperty("department") private val department: Department?, + @JsonProperty("dob") private val dob: String?, + @JsonProperty("emails") private val emails: List?, + @JsonProperty("employment") private val employment: Employment?, + @JsonProperty("employment_status") private val employmentStatus: EmploymentStatus?, + @JsonProperty("encrypted_ssn") private val encryptedSsn: String?, + @JsonProperty("end_date") private val endDate: String?, + @JsonProperty("ethnicity") private val ethnicity: Ethnicity?, + @JsonProperty("first_name") private val firstName: String?, + @JsonProperty("gender") private val gender: Gender?, + @JsonProperty("income") private val income: Income?, + @JsonProperty("income_history") private val incomeHistory: List?, + @JsonProperty("is_active") private val isActive: Boolean?, + @JsonProperty("last_name") private val lastName: String?, + @JsonProperty("latest_rehire_date") private val latestRehireDate: String?, + @JsonProperty("location") private val location: Location?, + @JsonProperty("manager") private val manager: Manager?, + @JsonProperty("middle_name") private val middleName: String?, + @JsonProperty("phone_numbers") private val phoneNumbers: List?, + @JsonProperty("preferred_name") private val preferredName: String?, + @JsonProperty("residence") private val residence: Location?, + @JsonProperty("source_id") private val sourceId: String?, + @JsonProperty("ssn") private val ssn: String?, + @JsonProperty("start_date") private val startDate: String?, + @JsonProperty("title") private val title: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** 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 + /** Worker's compensation classification code for this employee */ + @JsonProperty("class_code") + fun classCode(): Optional = Optional.ofNullable(classCode) - @JsonProperty("emails") fun emails(): List? = emails + /** + * 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(): Optional> = Optional.ofNullable(customFields) - @JsonProperty("phone_numbers") fun phoneNumbers(): List? = phoneNumbers + /** The department object. */ + @JsonProperty("department") + fun department(): Optional = Optional.ofNullable(department) - /** The gender of the individual. */ - @JsonProperty("gender") fun gender(): Gender? = gender + @JsonProperty("dob") fun dob(): Optional = Optional.ofNullable(dob) - /** The EEOC-defined ethnicity of the individual. */ - @JsonProperty("ethnicity") fun ethnicity(): Ethnicity? = ethnicity + @JsonProperty("emails") fun emails(): Optional> = Optional.ofNullable(emails) - @JsonProperty("dob") fun dob(): String? = dob + /** The employment object. */ + @JsonProperty("employment") + fun employment(): Optional = Optional.ofNullable(employment) - /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). - */ - @JsonProperty("ssn") fun ssn(): String? = ssn + /** The detailed employment status of the individual. */ + @JsonProperty("employment_status") + fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus) /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. */ - @JsonProperty("encrypted_ssn") fun encryptedSsn(): String? = encryptedSsn + @JsonProperty("encrypted_ssn") + fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn) - @JsonProperty("residence") fun residence(): Location? = residence + @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) - /** The current title of the individual. */ - @JsonProperty("title") fun title(): String? = title + /** The EEOC-defined ethnicity of the individual. */ + @JsonProperty("ethnicity") + fun ethnicity(): Optional = Optional.ofNullable(ethnicity) - /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") fun manager(): Manager? = manager + /** The legal first name of the individual. */ + @JsonProperty("first_name") + fun firstName(): Optional = Optional.ofNullable(firstName) - /** The department object. */ - @JsonProperty("department") fun department(): Department? = department + /** The gender of the individual. */ + @JsonProperty("gender") fun gender(): Optional = Optional.ofNullable(gender) - /** The employment object. */ - @JsonProperty("employment") fun employment(): Employment? = employment + /** + * 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(): Optional = Optional.ofNullable(income) - @JsonProperty("start_date") fun startDate(): String? = startDate + /** The array of income history. */ + @JsonProperty("income_history") + fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory) - @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(): Optional = Optional.ofNullable(isActive) - @JsonProperty("latest_rehire_date") fun latestRehireDate(): String? = latestRehireDate + /** The legal last name of the individual. */ + @JsonProperty("last_name") fun lastName(): Optional = Optional.ofNullable(lastName) - /** `true` if the individual an an active employee or contractor at the company. */ - @JsonProperty("is_active") fun isActive(): Boolean? = isActive + @JsonProperty("latest_rehire_date") + fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate) - /** The detailed employment status of the individual. */ - @JsonProperty("employment_status") - fun employmentStatus(): EmploymentStatus? = employmentStatus + @JsonProperty("location") fun location(): Optional = Optional.ofNullable(location) - /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") fun classCode(): String? = classCode + /** The manager object representing the manager of the individual within the org. */ + @JsonProperty("manager") fun manager(): Optional = Optional.ofNullable(manager) - @JsonProperty("location") fun location(): Location? = location + /** The legal middle name of the individual. */ + @JsonProperty("middle_name") + fun middleName(): Optional = Optional.ofNullable(middleName) - /** - * 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 + @JsonProperty("phone_numbers") + fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers) - /** The array of income history. */ - @JsonProperty("income_history") fun incomeHistory(): List? = incomeHistory + /** The preferred name of the individual. */ + @JsonProperty("preferred_name") + fun preferredName(): Optional = Optional.ofNullable(preferredName) + + @JsonProperty("residence") + fun residence(): Optional = Optional.ofNullable(residence) + + /** The source system's unique employment identifier for this individual */ + @JsonProperty("source_id") fun sourceId(): Optional = Optional.ofNullable(sourceId) /** - * 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. + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - @JsonProperty("custom_fields") fun customFields(): List? = customFields + @JsonProperty("ssn") fun ssn(): Optional = Optional.ofNullable(ssn) - /** The source system's unique employment identifier for this individual */ - @JsonProperty("source_id") fun sourceId(): String? = sourceId + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) + + /** The current title of the individual. */ + @JsonProperty("title") fun title(): Optional = Optional.ofNullable(title) @JsonAnyGetter @ExcludeMissing @@ -376,245 +334,351 @@ constructor( 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 classCode: String? = null + private var customFields: MutableList? = null private var department: Department? = null + private var dob: String? = null + private var emails: MutableList? = null private var employment: Employment? = null - private var startDate: String? = null + private var employmentStatus: EmploymentStatus? = null + private var encryptedSsn: String? = null private var endDate: String? = null - private var latestRehireDate: String? = null + private var ethnicity: Ethnicity? = null + private var firstName: String? = null + private var gender: Gender? = null + private var income: Income? = null + private var incomeHistory: MutableList? = null private var isActive: Boolean? = null - private var employmentStatus: EmploymentStatus? = null - private var classCode: String? = null + private var lastName: String? = null + private var latestRehireDate: String? = null private var location: Location? = null - private var income: Income? = null - private var incomeHistory: List? = null - private var customFields: List? = null + private var manager: Manager? = null + private var middleName: String? = null + private var phoneNumbers: MutableList? = null + private var preferredName: String? = null + private var residence: Location? = null private var sourceId: String? = null + private var ssn: String? = null + private var startDate: String? = null + private var title: 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.latestRehireDate = individualOrEmployment.latestRehireDate - this.isActive = individualOrEmployment.isActive - this.employmentStatus = individualOrEmployment.employmentStatus - 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) + classCode = individualOrEmployment.classCode + customFields = individualOrEmployment.customFields?.toMutableList() + department = individualOrEmployment.department + dob = individualOrEmployment.dob + emails = individualOrEmployment.emails?.toMutableList() + employment = individualOrEmployment.employment + employmentStatus = individualOrEmployment.employmentStatus + encryptedSsn = individualOrEmployment.encryptedSsn + endDate = individualOrEmployment.endDate + ethnicity = individualOrEmployment.ethnicity + firstName = individualOrEmployment.firstName + gender = individualOrEmployment.gender + income = individualOrEmployment.income + incomeHistory = individualOrEmployment.incomeHistory?.toMutableList() + isActive = individualOrEmployment.isActive + lastName = individualOrEmployment.lastName + latestRehireDate = individualOrEmployment.latestRehireDate + location = individualOrEmployment.location + manager = individualOrEmployment.manager + middleName = individualOrEmployment.middleName + phoneNumbers = individualOrEmployment.phoneNumbers?.toMutableList() + preferredName = individualOrEmployment.preferredName + residence = individualOrEmployment.residence + sourceId = individualOrEmployment.sourceId + ssn = individualOrEmployment.ssn + startDate = individualOrEmployment.startDate + title = individualOrEmployment.title + additionalProperties = individualOrEmployment.additionalProperties.toMutableMap() } - /** The legal first name of the individual. */ - @JsonProperty("first_name") - fun firstName(firstName: String) = apply { this.firstName = firstName } + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: String?) = apply { this.classCode = classCode } - /** The legal middle name of the individual. */ - @JsonProperty("middle_name") - fun middleName(middleName: String) = apply { this.middleName = middleName } + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) - /** The legal last name of the individual. */ - @JsonProperty("last_name") - fun lastName(lastName: String) = apply { this.lastName = lastName } + /** + * 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 = customFields?.toMutableList() + } - /** The preferred name of the individual. */ - @JsonProperty("preferred_name") - fun preferredName(preferredName: String) = apply { this.preferredName = preferredName } + /** + * 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: Optional>) = + customFields(customFields.orElse(null)) + + /** + * 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 { + customFields = (customFields ?: mutableListOf()).apply { add(customField) } + } + + /** The department object. */ + fun department(department: Department?) = apply { this.department = department } - @JsonProperty("emails") fun emails(emails: List) = apply { this.emails = emails } + /** The department object. */ + fun department(department: Optional) = department(department.orElse(null)) + + fun dob(dob: String?) = apply { this.dob = dob } + + fun dob(dob: Optional) = dob(dob.orElse(null)) - @JsonProperty("phone_numbers") - fun phoneNumbers(phoneNumbers: List) = apply { - this.phoneNumbers = phoneNumbers + fun emails(emails: List?) = apply { this.emails = emails?.toMutableList() } + + fun emails(emails: Optional>) = emails(emails.orElse(null)) + + fun addEmail(email: Email) = apply { + emails = (emails ?: mutableListOf()).apply { add(email) } } - /** The gender of the individual. */ - @JsonProperty("gender") fun gender(gender: Gender) = apply { this.gender = gender } + /** The employment object. */ + fun employment(employment: Employment?) = apply { this.employment = employment } - /** The EEOC-defined ethnicity of the individual. */ - @JsonProperty("ethnicity") - fun ethnicity(ethnicity: Ethnicity) = apply { this.ethnicity = ethnicity } + /** The employment object. */ + fun employment(employment: Optional) = employment(employment.orElse(null)) + + /** The detailed employment status of the individual. */ + fun employmentStatus(employmentStatus: EmploymentStatus?) = apply { + this.employmentStatus = employmentStatus + } - @JsonProperty("dob") fun dob(dob: String) = apply { this.dob = dob } + /** The detailed employment status of the individual. */ + fun employmentStatus(employmentStatus: Optional) = + employmentStatus(employmentStatus.orElse(null)) /** - * Social Security Number of the individual. This field is only available with the `ssn` - * scope enabled and the `options: { include: ['ssn'] }` param set in the body. - * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + * 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("ssn") fun ssn(ssn: String) = apply { this.ssn = ssn } + fun encryptedSsn(encryptedSsn: String?) = apply { this.encryptedSsn = encryptedSsn } /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param * set in the body. */ - @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 } + fun encryptedSsn(encryptedSsn: Optional) = + encryptedSsn(encryptedSsn.orElse(null)) - /** The department object. */ - @JsonProperty("department") - fun department(department: Department) = apply { this.department = department } + fun endDate(endDate: String?) = apply { this.endDate = endDate } - /** The employment object. */ - @JsonProperty("employment") - fun employment(employment: Employment) = apply { this.employment = employment } + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) - @JsonProperty("start_date") - fun startDate(startDate: String) = apply { this.startDate = startDate } + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Ethnicity?) = apply { this.ethnicity = ethnicity } - @JsonProperty("end_date") - fun endDate(endDate: String) = apply { this.endDate = endDate } + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) - @JsonProperty("latest_rehire_date") - fun latestRehireDate(latestRehireDate: String) = apply { - this.latestRehireDate = latestRehireDate - } + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = apply { this.firstName = firstName } - /** `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 first name of the individual. */ + fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) - /** The detailed employment status of the individual. */ - @JsonProperty("employment_status") - fun employmentStatus(employmentStatus: EmploymentStatus) = apply { - this.employmentStatus = employmentStatus - } + /** The gender of the individual. */ + fun gender(gender: Gender?) = apply { this.gender = gender } - /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") - fun classCode(classCode: String) = apply { this.classCode = classCode } + /** The gender of the individual. */ + fun gender(gender: Optional) = gender(gender.orElse(null)) - @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. + */ + fun income(income: Income?) = apply { this.income = income } /** * The employee's income as reported by the provider. This may not always be annualized * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - @JsonProperty("income") fun income(income: Income) = apply { this.income = income } + fun income(income: Optional) = income(income.orElse(null)) /** The array of income history. */ - @JsonProperty("income_history") - fun incomeHistory(incomeHistory: List) = apply { - this.incomeHistory = incomeHistory + fun incomeHistory(incomeHistory: List?) = apply { + this.incomeHistory = incomeHistory?.toMutableList() } - /** - * Custom fields for the individual. These are fields which are defined by the employer - * in the system. Custom fields are not currently supported for assisted connections. - */ - @JsonProperty("custom_fields") - fun customFields(customFields: List) = apply { - this.customFields = customFields + /** The array of income history. */ + fun incomeHistory(incomeHistory: Optional>) = + incomeHistory(incomeHistory.orElse(null)) + + /** The array of income history. */ + fun addIncomeHistory(incomeHistory: Income) = apply { + this.incomeHistory = + (this.incomeHistory ?: mutableListOf()).apply { add(incomeHistory) } + } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean?) = apply { this.isActive = isActive } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) + + /** `true` if the individual an an active employee or contractor at the company. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { this.lastName = lastName } + + /** The legal last name of the individual. */ + fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + + fun latestRehireDate(latestRehireDate: String?) = apply { + this.latestRehireDate = latestRehireDate } + fun latestRehireDate(latestRehireDate: Optional) = + latestRehireDate(latestRehireDate.orElse(null)) + + fun location(location: Location?) = apply { this.location = location } + + fun location(location: Optional) = location(location.orElse(null)) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager?) = apply { this.manager = manager } + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Optional) = manager(manager.orElse(null)) + + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = apply { this.middleName = middleName } + + /** The legal middle name of the individual. */ + fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + + fun phoneNumbers(phoneNumbers: List?) = apply { + this.phoneNumbers = phoneNumbers?.toMutableList() + } + + fun phoneNumbers(phoneNumbers: Optional>) = + phoneNumbers(phoneNumbers.orElse(null)) + + fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { + phoneNumbers = (phoneNumbers ?: mutableListOf()).apply { add(phoneNumber) } + } + + /** The preferred name of the individual. */ + fun preferredName(preferredName: String?) = apply { this.preferredName = preferredName } + + /** The preferred name of the individual. */ + fun preferredName(preferredName: Optional) = + preferredName(preferredName.orElse(null)) + + fun residence(residence: Location?) = apply { this.residence = residence } + + fun residence(residence: Optional) = residence(residence.orElse(null)) + + /** The source system's unique employment identifier for this individual */ + fun sourceId(sourceId: String?) = apply { this.sourceId = sourceId } + /** The source system's unique employment identifier for this individual */ - @JsonProperty("source_id") - fun sourceId(sourceId: String) = apply { this.sourceId = sourceId } + fun sourceId(sourceId: Optional) = sourceId(sourceId.orElse(null)) + + /** + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + */ + fun ssn(ssn: String?) = apply { this.ssn = ssn } + + /** + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + */ + fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) + + fun startDate(startDate: String?) = apply { this.startDate = startDate } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) + + /** The current title of the individual. */ + fun title(title: String?) = apply { this.title = title } + + /** The current title of the individual. */ + fun title(title: Optional) = title(title.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): IndividualOrEmployment = IndividualOrEmployment( - firstName, - middleName, - lastName, - preferredName, - emails?.toImmutable(), - phoneNumbers?.toImmutable(), - gender, - ethnicity, - dob, - ssn, - encryptedSsn, - residence, - title, - manager, + classCode, + customFields?.toImmutable(), department, + dob, + emails?.toImmutable(), employment, - startDate, - endDate, - latestRehireDate, - isActive, employmentStatus, - classCode, - location, + encryptedSsn, + endDate, + ethnicity, + firstName, + gender, income, incomeHistory?.toImmutable(), - customFields?.toImmutable(), + isActive, + lastName, + latestRehireDate, + location, + manager, + middleName, + phoneNumbers?.toImmutable(), + preferredName, + residence, sourceId, + ssn, + startDate, + title, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = CustomField.Builder::class) @NoAutoDetect class CustomField + @JsonCreator private constructor( - private val name: String?, - private val value: JsonValue?, - private val additionalProperties: Map, + @JsonProperty("name") private val name: String?, + @JsonProperty("value") private val value: JsonValue?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) - @JsonProperty("value") fun value(): JsonValue? = value + @JsonProperty("value") fun value(): Optional = Optional.ofNullable(value) @JsonAnyGetter @ExcludeMissing @@ -635,23 +699,26 @@ constructor( @JvmSynthetic internal fun from(customField: CustomField) = apply { - this.name = customField.name - this.value = customField.value - additionalProperties(customField.additionalProperties) + name = customField.name + value = customField.value + additionalProperties = customField.additionalProperties.toMutableMap() } - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + fun name(name: Optional) = name(name.orElse(null)) - @JsonProperty("value") fun value(value: JsonValue) = apply { this.value = value } + fun value(value: JsonValue?) = apply { this.value = value } + + fun value(value: Optional) = value(value.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -659,6 +726,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CustomField = CustomField( name, @@ -686,16 +761,17 @@ constructor( } /** The department object. */ - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: String?, - private val additionalProperties: Map, + @JsonProperty("name") private val name: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The name of the department associated with the individual. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) @JsonAnyGetter @ExcludeMissing @@ -715,21 +791,23 @@ constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = department.additionalProperties.toMutableMap() } /** The name of the department associated with the individual. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + /** The name of the department associated with the individual. */ + fun name(name: Optional) = name(name.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -737,6 +815,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -758,18 +844,19 @@ constructor( "Department{name=$name, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = Email.Builder::class) @NoAutoDetect class Email + @JsonCreator private constructor( - private val data: String?, - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("data") private val data: String?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("data") fun data(): String? = data + @JsonProperty("data") fun data(): Optional = Optional.ofNullable(data) - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -790,23 +877,26 @@ constructor( @JvmSynthetic internal fun from(email: Email) = apply { - this.data = email.data - this.type = email.type - additionalProperties(email.additionalProperties) + data = email.data + type = email.type + additionalProperties = email.additionalProperties.toMutableMap() } - @JsonProperty("data") fun data(data: String) = apply { this.data = data } + fun data(data: String?) = apply { this.data = data } - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun data(data: Optional) = data(data.orElse(null)) + + fun type(type: Type?) = apply { this.type = type } + + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -814,6 +904,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Email = Email( data, @@ -898,23 +996,24 @@ constructor( } /** The employment object. */ - @JsonDeserialize(builder = Employment.Builder::class) @NoAutoDetect class Employment + @JsonCreator private constructor( - private val type: Type?, - private val subtype: Subtype?, - private val additionalProperties: Map, + @JsonProperty("subtype") private val subtype: Subtype?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** 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 + @JsonProperty("subtype") fun subtype(): Optional = Optional.ofNullable(subtype) + + /** The main employment type of the individual. */ + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -929,35 +1028,42 @@ constructor( class Builder { - private var type: Type? = null private var subtype: Subtype? = null + private var type: Type? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employment: Employment) = apply { - this.type = employment.type - this.subtype = employment.subtype - additionalProperties(employment.additionalProperties) + subtype = employment.subtype + type = employment.type + additionalProperties = employment.additionalProperties.toMutableMap() } - /** 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`. + */ + fun subtype(subtype: Subtype?) = apply { this.subtype = subtype } /** * 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 subtype(subtype: Optional) = subtype(subtype.orElse(null)) + + /** The main employment type of the individual. */ + fun type(type: Type?) = apply { this.type = type } + + /** The main employment type of the individual. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -965,10 +1071,18 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Employment = Employment( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -1116,17 +1230,17 @@ constructor( return true } - return /* spotless:off */ other is Employment && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Employment && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } class EmploymentStatus @@ -1381,16 +1495,17 @@ constructor( } /** The manager object representing the manager of the individual within the org. */ - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: String?, - private val additionalProperties: Map, + @JsonProperty("id") private val id: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") fun id(): String? = id + @JsonProperty("id") fun id(): Optional = Optional.ofNullable(id) @JsonAnyGetter @ExcludeMissing @@ -1410,21 +1525,23 @@ constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } /** A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + fun id(id: String?) = apply { this.id = id } + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(id: Optional) = id(id.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1432,6 +1549,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -1452,18 +1577,19 @@ constructor( override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = PhoneNumber.Builder::class) @NoAutoDetect class PhoneNumber + @JsonCreator private constructor( - private val data: String?, - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("data") private val data: String?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("data") fun data(): String? = data + @JsonProperty("data") fun data(): Optional = Optional.ofNullable(data) - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -1484,23 +1610,26 @@ constructor( @JvmSynthetic internal fun from(phoneNumber: PhoneNumber) = apply { - this.data = phoneNumber.data - this.type = phoneNumber.type - additionalProperties(phoneNumber.additionalProperties) + data = phoneNumber.data + type = phoneNumber.type + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - @JsonProperty("data") fun data(data: String) = apply { this.data = data } + fun data(data: String?) = apply { this.data = data } - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun data(data: Optional) = data(data.orElse(null)) + + fun type(type: Type?) = apply { this.type = type } + + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1508,6 +1637,14 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PhoneNumber = PhoneNumber( data, @@ -1596,17 +1733,17 @@ constructor( return true } - return /* spotless:off */ other is IndividualOrEmployment && firstName == other.firstName && middleName == other.middleName && lastName == other.lastName && preferredName == other.preferredName && emails == other.emails && phoneNumbers == other.phoneNumbers && gender == other.gender && ethnicity == other.ethnicity && dob == other.dob && ssn == other.ssn && encryptedSsn == other.encryptedSsn && residence == other.residence && title == other.title && manager == other.manager && department == other.department && employment == other.employment && startDate == other.startDate && endDate == other.endDate && latestRehireDate == other.latestRehireDate && isActive == other.isActive && employmentStatus == other.employmentStatus && classCode == other.classCode && location == other.location && income == other.income && incomeHistory == other.incomeHistory && customFields == other.customFields && sourceId == other.sourceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualOrEmployment && classCode == other.classCode && customFields == other.customFields && department == other.department && dob == other.dob && emails == other.emails && employment == other.employment && employmentStatus == other.employmentStatus && encryptedSsn == other.encryptedSsn && endDate == other.endDate && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && sourceId == other.sourceId && ssn == other.ssn && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(firstName, middleName, lastName, preferredName, emails, phoneNumbers, gender, ethnicity, dob, ssn, encryptedSsn, residence, title, manager, department, employment, startDate, endDate, latestRehireDate, isActive, employmentStatus, classCode, location, income, incomeHistory, customFields, sourceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(classCode, customFields, department, dob, emails, employment, employmentStatus, encryptedSsn, endDate, ethnicity, firstName, gender, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, phoneNumbers, preferredName, residence, sourceId, ssn, startDate, title, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = 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, latestRehireDate=$latestRehireDate, isActive=$isActive, employmentStatus=$employmentStatus, classCode=$classCode, location=$location, income=$income, incomeHistory=$incomeHistory, customFields=$customFields, sourceId=$sourceId, additionalProperties=$additionalProperties}" + "IndividualOrEmployment{classCode=$classCode, customFields=$customFields, department=$department, dob=$dob, emails=$emails, employment=$employment, employmentStatus=$employmentStatus, encryptedSsn=$encryptedSsn, endDate=$endDate, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, sourceId=$sourceId, ssn=$ssn, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 475f1af2..9a2fe56a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -22,97 +22,77 @@ 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 employmentStatus: EmploymentStatus?, - 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 latestRehireDate: 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 body: SandboxEmploymentUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun individualId(): String = individualId - fun classCode(): Optional = Optional.ofNullable(classCode) + /** Worker's compensation classification code for this employee */ + fun classCode(): Optional = body.classCode() - fun customFields(): Optional> = Optional.ofNullable(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 customFields(): Optional> = body.customFields() - fun department(): Optional = Optional.ofNullable(department) + /** The department object. */ + fun department(): Optional = body.department() - fun employment(): Optional = Optional.ofNullable(employment) + /** The employment object. */ + fun employment(): Optional = body.employment() - fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus) + /** The detailed employment status of the individual. */ + fun employmentStatus(): Optional = body.employmentStatus() - fun endDate(): Optional = Optional.ofNullable(endDate) + fun endDate(): Optional = body.endDate() - fun firstName(): Optional = Optional.ofNullable(firstName) + /** The legal first name of the individual. */ + fun firstName(): Optional = body.firstName() - fun income(): Optional = Optional.ofNullable(income) + /** + * The employee's income as reported by the provider. This may not always be annualized income, + * but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what information the + * provider returns. + */ + fun income(): Optional = body.income() - fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory) + /** The array of income history. */ + fun incomeHistory(): Optional> = body.incomeHistory() - fun isActive(): Optional = Optional.ofNullable(isActive) + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(): Optional = body.isActive() - fun lastName(): Optional = Optional.ofNullable(lastName) + /** The legal last name of the individual. */ + fun lastName(): Optional = body.lastName() - fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate) + fun latestRehireDate(): Optional = body.latestRehireDate() - fun location(): Optional = Optional.ofNullable(location) + fun location(): Optional = body.location() - fun manager(): Optional = Optional.ofNullable(manager) + /** The manager object representing the manager of the individual within the org. */ + fun manager(): Optional = body.manager() - fun middleName(): Optional = Optional.ofNullable(middleName) + /** The legal middle name of the individual. */ + fun middleName(): Optional = body.middleName() - fun sourceId(): Optional = Optional.ofNullable(sourceId) + /** The source system's unique employment identifier for this individual */ + fun sourceId(): Optional = body.sourceId() - fun startDate(): Optional = Optional.ofNullable(startDate) + fun startDate(): Optional = body.startDate() - fun title(): Optional = Optional.ofNullable(title) + /** The current title of the individual. */ + fun title(): Optional = body.title() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SandboxEmploymentUpdateBody { - return SandboxEmploymentUpdateBody( - classCode, - customFields, - department, - employment, - employmentStatus, - endDate, - firstName, - income, - incomeHistory, - isActive, - lastName, - latestRehireDate, - location, - manager, - middleName, - sourceId, - startDate, - title, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SandboxEmploymentUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -125,88 +105,98 @@ constructor( } } - @JsonDeserialize(builder = SandboxEmploymentUpdateBody.Builder::class) @NoAutoDetect class SandboxEmploymentUpdateBody + @JsonCreator internal constructor( - private val classCode: String?, - private val customFields: List?, - private val department: Department?, - private val employment: Employment?, - private val employmentStatus: EmploymentStatus?, - 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 latestRehireDate: 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, + @JsonProperty("class_code") private val classCode: String?, + @JsonProperty("custom_fields") private val customFields: List?, + @JsonProperty("department") private val department: Department?, + @JsonProperty("employment") private val employment: Employment?, + @JsonProperty("employment_status") private val employmentStatus: EmploymentStatus?, + @JsonProperty("end_date") private val endDate: String?, + @JsonProperty("first_name") private val firstName: String?, + @JsonProperty("income") private val income: Income?, + @JsonProperty("income_history") private val incomeHistory: List?, + @JsonProperty("is_active") private val isActive: Boolean?, + @JsonProperty("last_name") private val lastName: String?, + @JsonProperty("latest_rehire_date") private val latestRehireDate: String?, + @JsonProperty("location") private val location: Location?, + @JsonProperty("manager") private val manager: Manager?, + @JsonProperty("middle_name") private val middleName: String?, + @JsonProperty("source_id") private val sourceId: String?, + @JsonProperty("start_date") private val startDate: String?, + @JsonProperty("title") private val title: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") fun classCode(): String? = classCode + @JsonProperty("class_code") + fun classCode(): Optional = Optional.ofNullable(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 + @JsonProperty("custom_fields") + fun customFields(): Optional> = Optional.ofNullable(customFields) /** The department object. */ - @JsonProperty("department") fun department(): Department? = department + @JsonProperty("department") + fun department(): Optional = Optional.ofNullable(department) /** The employment object. */ - @JsonProperty("employment") fun employment(): Employment? = employment + @JsonProperty("employment") + fun employment(): Optional = Optional.ofNullable(employment) /** The detailed employment status of the individual. */ @JsonProperty("employment_status") - fun employmentStatus(): EmploymentStatus? = employmentStatus + fun employmentStatus(): Optional = Optional.ofNullable(employmentStatus) - @JsonProperty("end_date") fun endDate(): String? = endDate + @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) /** The legal first name of the individual. */ - @JsonProperty("first_name") fun firstName(): String? = firstName + @JsonProperty("first_name") + fun firstName(): Optional = Optional.ofNullable(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 + @JsonProperty("income") fun income(): Optional = Optional.ofNullable(income) /** The array of income history. */ - @JsonProperty("income_history") fun incomeHistory(): List? = incomeHistory + @JsonProperty("income_history") + fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory) /** `true` if the individual an an active employee or contractor at the company. */ - @JsonProperty("is_active") fun isActive(): Boolean? = isActive + @JsonProperty("is_active") fun isActive(): Optional = Optional.ofNullable(isActive) /** The legal last name of the individual. */ - @JsonProperty("last_name") fun lastName(): String? = lastName + @JsonProperty("last_name") fun lastName(): Optional = Optional.ofNullable(lastName) - @JsonProperty("latest_rehire_date") fun latestRehireDate(): String? = latestRehireDate + @JsonProperty("latest_rehire_date") + fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate) - @JsonProperty("location") fun location(): Location? = location + @JsonProperty("location") fun location(): Optional = Optional.ofNullable(location) /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") fun manager(): Manager? = manager + @JsonProperty("manager") fun manager(): Optional = Optional.ofNullable(manager) /** The legal middle name of the individual. */ - @JsonProperty("middle_name") fun middleName(): String? = middleName + @JsonProperty("middle_name") + fun middleName(): Optional = Optional.ofNullable(middleName) /** The source system's unique employment identifier for this individual */ - @JsonProperty("source_id") fun sourceId(): String? = sourceId + @JsonProperty("source_id") fun sourceId(): Optional = Optional.ofNullable(sourceId) - @JsonProperty("start_date") fun startDate(): String? = startDate + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) /** The current title of the individual. */ - @JsonProperty("title") fun title(): String? = title + @JsonProperty("title") fun title(): Optional = Optional.ofNullable(title) @JsonAnyGetter @ExcludeMissing @@ -222,14 +212,14 @@ constructor( class Builder { private var classCode: String? = null - private var customFields: List? = null + private var customFields: MutableList? = null private var department: Department? = null private var employment: Employment? = null private var employmentStatus: EmploymentStatus? = null private var endDate: String? = null private var firstName: String? = null private var income: Income? = null - private var incomeHistory: List? = null + private var incomeHistory: MutableList? = null private var isActive: Boolean? = null private var lastName: String? = null private var latestRehireDate: String? = null @@ -243,122 +233,191 @@ constructor( @JvmSynthetic internal fun from(sandboxEmploymentUpdateBody: SandboxEmploymentUpdateBody) = apply { - this.classCode = sandboxEmploymentUpdateBody.classCode - this.customFields = sandboxEmploymentUpdateBody.customFields - this.department = sandboxEmploymentUpdateBody.department - this.employment = sandboxEmploymentUpdateBody.employment - this.employmentStatus = sandboxEmploymentUpdateBody.employmentStatus - 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.latestRehireDate = sandboxEmploymentUpdateBody.latestRehireDate - 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) + classCode = sandboxEmploymentUpdateBody.classCode + customFields = sandboxEmploymentUpdateBody.customFields?.toMutableList() + department = sandboxEmploymentUpdateBody.department + employment = sandboxEmploymentUpdateBody.employment + employmentStatus = sandboxEmploymentUpdateBody.employmentStatus + endDate = sandboxEmploymentUpdateBody.endDate + firstName = sandboxEmploymentUpdateBody.firstName + income = sandboxEmploymentUpdateBody.income + incomeHistory = sandboxEmploymentUpdateBody.incomeHistory?.toMutableList() + isActive = sandboxEmploymentUpdateBody.isActive + lastName = sandboxEmploymentUpdateBody.lastName + latestRehireDate = sandboxEmploymentUpdateBody.latestRehireDate + location = sandboxEmploymentUpdateBody.location + manager = sandboxEmploymentUpdateBody.manager + middleName = sandboxEmploymentUpdateBody.middleName + sourceId = sandboxEmploymentUpdateBody.sourceId + startDate = sandboxEmploymentUpdateBody.startDate + title = sandboxEmploymentUpdateBody.title + additionalProperties = + sandboxEmploymentUpdateBody.additionalProperties.toMutableMap() } /** Worker's compensation classification code for this employee */ - @JsonProperty("class_code") - fun classCode(classCode: String) = apply { this.classCode = classCode } + fun classCode(classCode: String?) = apply { this.classCode = classCode } + + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) + + /** + * 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 = customFields?.toMutableList() + } + + /** + * Custom fields for the individual. These are fields which are defined by the employer + * in the system. Custom fields are not currently supported for assisted connections. + */ + fun customFields(customFields: Optional>) = + customFields(customFields.orElse(null)) /** * 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 + fun addCustomField(customField: CustomField) = apply { + customFields = (customFields ?: mutableListOf()).apply { add(customField) } } /** The department object. */ - @JsonProperty("department") - fun department(department: Department) = apply { this.department = department } + fun department(department: Department?) = apply { this.department = department } + + /** The department object. */ + fun department(department: Optional) = department(department.orElse(null)) /** The employment object. */ - @JsonProperty("employment") - fun employment(employment: Employment) = apply { this.employment = employment } + fun employment(employment: Employment?) = apply { this.employment = employment } + + /** The employment object. */ + fun employment(employment: Optional) = employment(employment.orElse(null)) /** The detailed employment status of the individual. */ - @JsonProperty("employment_status") - fun employmentStatus(employmentStatus: EmploymentStatus) = apply { + fun employmentStatus(employmentStatus: EmploymentStatus?) = apply { this.employmentStatus = employmentStatus } - @JsonProperty("end_date") - fun endDate(endDate: String) = apply { this.endDate = endDate } + /** The detailed employment status of the individual. */ + fun employmentStatus(employmentStatus: Optional) = + employmentStatus(employmentStatus.orElse(null)) + + fun endDate(endDate: String?) = apply { this.endDate = endDate } + + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = apply { this.firstName = firstName } /** The legal first name of the individual. */ - @JsonProperty("first_name") - fun firstName(firstName: String) = apply { this.firstName = firstName } + fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) /** * 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 } + fun income(income: Income?) = apply { this.income = income } + + /** + * The employee's income as reported by the provider. This may not always be annualized + * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what + * information the provider returns. + */ + fun income(income: Optional) = income(income.orElse(null)) /** The array of income history. */ - @JsonProperty("income_history") - fun incomeHistory(incomeHistory: List) = apply { - this.incomeHistory = incomeHistory + fun incomeHistory(incomeHistory: List?) = apply { + this.incomeHistory = incomeHistory?.toMutableList() + } + + /** The array of income history. */ + fun incomeHistory(incomeHistory: Optional>) = + incomeHistory(incomeHistory.orElse(null)) + + /** The array of income history. */ + fun addIncomeHistory(incomeHistory: Income) = apply { + this.incomeHistory = + (this.incomeHistory ?: mutableListOf()).apply { add(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 } + fun isActive(isActive: Boolean?) = apply { this.isActive = isActive } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) + + /** `true` if the individual an an active employee or contractor at the company. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { this.lastName = lastName } /** The legal last name of the individual. */ - @JsonProperty("last_name") - fun lastName(lastName: String) = apply { this.lastName = lastName } + fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) - @JsonProperty("latest_rehire_date") - fun latestRehireDate(latestRehireDate: String) = apply { + fun latestRehireDate(latestRehireDate: String?) = apply { this.latestRehireDate = latestRehireDate } - @JsonProperty("location") - fun location(location: Location) = apply { this.location = location } + fun latestRehireDate(latestRehireDate: Optional) = + latestRehireDate(latestRehireDate.orElse(null)) + + fun location(location: Location?) = apply { this.location = location } + + fun location(location: Optional) = location(location.orElse(null)) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager?) = apply { this.manager = manager } /** The manager object representing the manager of the individual within the org. */ - @JsonProperty("manager") - fun manager(manager: Manager) = apply { this.manager = manager } + fun manager(manager: Optional) = manager(manager.orElse(null)) + + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = apply { this.middleName = middleName } /** The legal middle name of the individual. */ - @JsonProperty("middle_name") - fun middleName(middleName: String) = apply { this.middleName = middleName } + fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) /** The source system's unique employment identifier for this individual */ - @JsonProperty("source_id") - fun sourceId(sourceId: String) = apply { this.sourceId = sourceId } + fun sourceId(sourceId: String?) = apply { this.sourceId = sourceId } + + /** The source system's unique employment identifier for this individual */ + fun sourceId(sourceId: Optional) = sourceId(sourceId.orElse(null)) + + fun startDate(startDate: String?) = apply { this.startDate = startDate } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) - @JsonProperty("start_date") - fun startDate(startDate: String) = apply { this.startDate = startDate } + /** The current title of the individual. */ + fun title(title: String?) = apply { this.title = title } /** The current title of the individual. */ - @JsonProperty("title") fun title(title: String) = apply { this.title = title } + fun title(title: Optional) = title(title.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxEmploymentUpdateBody = SandboxEmploymentUpdateBody( classCode, @@ -412,136 +471,159 @@ constructor( 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 employmentStatus: EmploymentStatus? = 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 latestRehireDate: 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 body: SandboxEmploymentUpdateBody.Builder = + SandboxEmploymentUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxEmploymentUpdateParams: SandboxEmploymentUpdateParams) = apply { individualId = sandboxEmploymentUpdateParams.individualId - classCode = sandboxEmploymentUpdateParams.classCode - customFields = - sandboxEmploymentUpdateParams.customFields?.toMutableList() ?: mutableListOf() - department = sandboxEmploymentUpdateParams.department - employment = sandboxEmploymentUpdateParams.employment - employmentStatus = sandboxEmploymentUpdateParams.employmentStatus - endDate = sandboxEmploymentUpdateParams.endDate - firstName = sandboxEmploymentUpdateParams.firstName - income = sandboxEmploymentUpdateParams.income - incomeHistory = - sandboxEmploymentUpdateParams.incomeHistory?.toMutableList() ?: mutableListOf() - isActive = sandboxEmploymentUpdateParams.isActive - lastName = sandboxEmploymentUpdateParams.lastName - latestRehireDate = sandboxEmploymentUpdateParams.latestRehireDate - location = sandboxEmploymentUpdateParams.location - manager = sandboxEmploymentUpdateParams.manager - middleName = sandboxEmploymentUpdateParams.middleName - sourceId = sandboxEmploymentUpdateParams.sourceId - startDate = sandboxEmploymentUpdateParams.startDate - title = sandboxEmploymentUpdateParams.title + body = sandboxEmploymentUpdateParams.body.toBuilder() additionalHeaders = sandboxEmploymentUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxEmploymentUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxEmploymentUpdateParams.additionalBodyProperties.toMutableMap() } fun individualId(individualId: String) = apply { this.individualId = individualId } /** Worker's compensation classification code for this employee */ - fun classCode(classCode: String) = apply { this.classCode = classCode } + fun classCode(classCode: String?) = apply { body.classCode(classCode) } + + /** Worker's compensation classification code for this employee */ + fun classCode(classCode: Optional) = classCode(classCode.orElse(null)) /** * 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) + fun customFields(customFields: List?) = apply { + body.customFields(customFields) } /** * Custom fields for the individual. These are fields which are defined by the employer in * the system. Custom fields are not currently supported for assisted connections. */ - fun addCustomField(customField: CustomField) = apply { this.customFields.add(customField) } + fun customFields(customFields: Optional>) = + customFields(customFields.orElse(null)) + + /** + * 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 { body.addCustomField(customField) } + + /** The department object. */ + fun department(department: Department?) = apply { body.department(department) } /** The department object. */ - fun department(department: Department) = apply { this.department = department } + fun department(department: Optional) = department(department.orElse(null)) /** The employment object. */ - fun employment(employment: Employment) = apply { this.employment = employment } + fun employment(employment: Employment?) = apply { body.employment(employment) } + + /** The employment object. */ + fun employment(employment: Optional) = employment(employment.orElse(null)) /** The detailed employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus) = apply { - this.employmentStatus = employmentStatus + fun employmentStatus(employmentStatus: EmploymentStatus?) = apply { + body.employmentStatus(employmentStatus) } - fun endDate(endDate: String) = apply { this.endDate = endDate } + /** The detailed employment status of the individual. */ + fun employmentStatus(employmentStatus: Optional) = + employmentStatus(employmentStatus.orElse(null)) + + fun endDate(endDate: String?) = apply { body.endDate(endDate) } + + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = apply { body.firstName(firstName) } /** The legal first name of the individual. */ - fun firstName(firstName: String) = apply { this.firstName = firstName } + fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + + /** + * 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 { body.income(income) } /** * The employee's income as reported by the provider. This may not always be annualized * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what * information the provider returns. */ - fun income(income: Income) = apply { this.income = income } + fun income(income: Optional) = income(income.orElse(null)) /** The array of income history. */ - fun incomeHistory(incomeHistory: List) = apply { - this.incomeHistory.clear() - this.incomeHistory.addAll(incomeHistory) + fun incomeHistory(incomeHistory: List?) = apply { + body.incomeHistory(incomeHistory) } /** The array of income history. */ - fun addIncomeHistory(incomeHistory: Income) = apply { - this.incomeHistory.add(incomeHistory) - } + fun incomeHistory(incomeHistory: Optional>) = + incomeHistory(incomeHistory.orElse(null)) + + /** The array of income history. */ + fun addIncomeHistory(incomeHistory: Income) = apply { body.addIncomeHistory(incomeHistory) } /** `true` if the individual an an active employee or contractor at the company. */ - fun isActive(isActive: Boolean) = apply { this.isActive = isActive } + fun isActive(isActive: Boolean?) = apply { body.isActive(isActive) } + + /** `true` if the individual an an active employee or contractor at the company. */ + fun isActive(isActive: Boolean) = isActive(isActive as Boolean?) + + /** `true` if the individual an an active employee or contractor at the company. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun isActive(isActive: Optional) = isActive(isActive.orElse(null) as Boolean?) + + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { body.lastName(lastName) } /** The legal last name of the individual. */ - fun lastName(lastName: String) = apply { this.lastName = lastName } + fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) - fun latestRehireDate(latestRehireDate: String) = apply { - this.latestRehireDate = latestRehireDate + fun latestRehireDate(latestRehireDate: String?) = apply { + body.latestRehireDate(latestRehireDate) } - fun location(location: Location) = apply { this.location = location } + fun latestRehireDate(latestRehireDate: Optional) = + latestRehireDate(latestRehireDate.orElse(null)) + + fun location(location: Location?) = apply { body.location(location) } + + fun location(location: Optional) = location(location.orElse(null)) + + /** The manager object representing the manager of the individual within the org. */ + fun manager(manager: Manager?) = apply { body.manager(manager) } /** The manager object representing the manager of the individual within the org. */ - fun manager(manager: Manager) = apply { this.manager = manager } + fun manager(manager: Optional) = manager(manager.orElse(null)) + + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = apply { body.middleName(middleName) } /** The legal middle name of the individual. */ - fun middleName(middleName: String) = apply { this.middleName = middleName } + fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) /** The source system's unique employment identifier for this individual */ - fun sourceId(sourceId: String) = apply { this.sourceId = sourceId } + fun sourceId(sourceId: String?) = apply { body.sourceId(sourceId) } + + /** The source system's unique employment identifier for this individual */ + fun sourceId(sourceId: Optional) = sourceId(sourceId.orElse(null)) + + fun startDate(startDate: String?) = apply { body.startDate(startDate) } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) - fun startDate(startDate: String) = apply { this.startDate = startDate } + /** The current title of the individual. */ + fun title(title: String?) = apply { body.title(title) } /** The current title of the individual. */ - fun title(title: String) = apply { this.title = title } + fun title(title: Optional) = title(title.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -642,66 +724,46 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxEmploymentUpdateParams = SandboxEmploymentUpdateParams( checkNotNull(individualId) { "`individualId` is required but was not set" }, - classCode, - customFields.toImmutable().ifEmpty { null }, - department, - employment, - employmentStatus, - endDate, - firstName, - income, - incomeHistory.toImmutable().ifEmpty { null }, - isActive, - lastName, - latestRehireDate, - location, - manager, - middleName, - sourceId, - startDate, - title, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = CustomField.Builder::class) @NoAutoDetect class CustomField + @JsonCreator private constructor( - private val name: String?, - private val value: JsonValue?, - private val additionalProperties: Map, + @JsonProperty("name") private val name: String?, + @JsonProperty("value") private val value: JsonValue?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) - @JsonProperty("value") fun value(): JsonValue? = value + @JsonProperty("value") fun value(): Optional = Optional.ofNullable(value) @JsonAnyGetter @ExcludeMissing @@ -722,29 +784,38 @@ constructor( @JvmSynthetic internal fun from(customField: CustomField) = apply { - this.name = customField.name - this.value = customField.value - additionalProperties(customField.additionalProperties) + name = customField.name + value = customField.value + additionalProperties = customField.additionalProperties.toMutableMap() } - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + fun name(name: Optional) = name(name.orElse(null)) + + fun value(value: JsonValue?) = apply { this.value = value } - @JsonProperty("value") fun value(value: JsonValue) = apply { this.value = value } + fun value(value: Optional) = value(value.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): CustomField = CustomField( name, @@ -772,16 +843,17 @@ constructor( } /** The department object. */ - @JsonDeserialize(builder = Department.Builder::class) @NoAutoDetect class Department + @JsonCreator private constructor( - private val name: String?, - private val additionalProperties: Map, + @JsonProperty("name") private val name: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The name of the department associated with the individual. */ - @JsonProperty("name") fun name(): String? = name + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) @JsonAnyGetter @ExcludeMissing @@ -801,27 +873,35 @@ constructor( @JvmSynthetic internal fun from(department: Department) = apply { - this.name = department.name - additionalProperties(department.additionalProperties) + name = department.name + additionalProperties = department.additionalProperties.toMutableMap() } /** The name of the department associated with the individual. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + fun name(name: String?) = apply { this.name = name } + + /** The name of the department associated with the individual. */ + fun name(name: Optional) = name(name.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Department = Department(name, additionalProperties.toImmutable()) } @@ -844,23 +924,24 @@ constructor( } /** The employment object. */ - @JsonDeserialize(builder = Employment.Builder::class) @NoAutoDetect class Employment + @JsonCreator private constructor( - private val type: Type?, - private val subtype: Subtype?, - private val additionalProperties: Map, + @JsonProperty("subtype") private val subtype: Subtype?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** 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 + @JsonProperty("subtype") fun subtype(): Optional = Optional.ofNullable(subtype) + + /** The main employment type of the individual. */ + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -875,45 +956,58 @@ constructor( class Builder { - private var type: Type? = null private var subtype: Subtype? = null + private var type: Type? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(employment: Employment) = apply { - this.type = employment.type - this.subtype = employment.subtype - additionalProperties(employment.additionalProperties) + subtype = employment.subtype + type = employment.type + additionalProperties = employment.additionalProperties.toMutableMap() } - /** 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`. + */ + fun subtype(subtype: Subtype?) = apply { this.subtype = subtype } /** * 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 subtype(subtype: Optional) = subtype(subtype.orElse(null)) + + /** The main employment type of the individual. */ + fun type(type: Type?) = apply { this.type = type } + + /** The main employment type of the individual. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Employment = Employment( - type, subtype, + type, additionalProperties.toImmutable(), ) } @@ -1061,17 +1155,17 @@ constructor( return true } - return /* spotless:off */ other is Employment && type == other.type && subtype == other.subtype && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Employment && subtype == other.subtype && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, subtype, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(subtype, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}" + "Employment{subtype=$subtype, type=$type, additionalProperties=$additionalProperties}" } class EmploymentStatus @@ -1162,16 +1256,17 @@ constructor( } /** The manager object representing the manager of the individual within the org. */ - @JsonDeserialize(builder = Manager.Builder::class) @NoAutoDetect class Manager + @JsonCreator private constructor( - private val id: String?, - private val additionalProperties: Map, + @JsonProperty("id") private val id: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") fun id(): String? = id + @JsonProperty("id") fun id(): Optional = Optional.ofNullable(id) @JsonAnyGetter @ExcludeMissing @@ -1191,27 +1286,35 @@ constructor( @JvmSynthetic internal fun from(manager: Manager) = apply { - this.id = manager.id - additionalProperties(manager.additionalProperties) + id = manager.id + additionalProperties = manager.additionalProperties.toMutableMap() } /** A stable Finch `id` (UUID v4) for an individual in the company. */ - @JsonProperty("id") fun id(id: String) = apply { this.id = id } + fun id(id: String?) = apply { this.id = id } + + /** A stable Finch `id` (UUID v4) for an individual in the company. */ + fun id(id: Optional) = id(id.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Manager = Manager(id, additionalProperties.toImmutable()) } @@ -1237,11 +1340,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxEmploymentUpdateParams && individualId == other.individualId && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxEmploymentUpdateParams && individualId == other.individualId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualId, classCode, customFields, department, employment, employmentStatus, endDate, firstName, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, sourceId, startDate, title, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxEmploymentUpdateParams{individualId=$individualId, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxEmploymentUpdateParams{individualId=$individualId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 983accde..df20ea2a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -22,73 +22,60 @@ 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 body: SandboxIndividualUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { fun individualId(): String = individualId - fun dob(): Optional = Optional.ofNullable(dob) + fun dob(): Optional = body.dob() - fun emails(): Optional> = Optional.ofNullable(emails) + fun emails(): Optional> = body.emails() - fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn) + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in + * the body. + */ + fun encryptedSsn(): Optional = body.encryptedSsn() - fun ethnicity(): Optional = Optional.ofNullable(ethnicity) + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(): Optional = body.ethnicity() - fun firstName(): Optional = Optional.ofNullable(firstName) + /** The legal first name of the individual. */ + fun firstName(): Optional = body.firstName() - fun gender(): Optional = Optional.ofNullable(gender) + /** The gender of the individual. */ + fun gender(): Optional = body.gender() - fun lastName(): Optional = Optional.ofNullable(lastName) + /** The legal last name of the individual. */ + fun lastName(): Optional = body.lastName() - fun middleName(): Optional = Optional.ofNullable(middleName) + /** The legal middle name of the individual. */ + fun middleName(): Optional = body.middleName() - fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers) + fun phoneNumbers(): Optional> = body.phoneNumbers() - fun preferredName(): Optional = Optional.ofNullable(preferredName) + /** The preferred name of the individual. */ + fun preferredName(): Optional = body.preferredName() - fun residence(): Optional = Optional.ofNullable(residence) + fun residence(): Optional = body.residence() - fun ssn(): Optional = Optional.ofNullable(ssn) + /** + * Social Security Number of the individual. This field is only available with the `ssn` scope + * enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + */ + fun ssn(): Optional = body.ssn() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties - - @JvmSynthetic - internal fun getBody(): SandboxIndividualUpdateBody { - return SandboxIndividualUpdateBody( - dob, - emails, - encryptedSsn, - ethnicity, - firstName, - gender, - lastName, - middleName, - phoneNumbers, - preferredName, - residence, - ssn, - additionalBodyProperties, - ) - } + fun _additionalBodyProperties(): Map = body._additionalProperties() + + @JvmSynthetic internal fun getBody(): SandboxIndividualUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -101,64 +88,72 @@ constructor( } } - @JsonDeserialize(builder = SandboxIndividualUpdateBody.Builder::class) @NoAutoDetect class SandboxIndividualUpdateBody + @JsonCreator 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, + @JsonProperty("dob") private val dob: String?, + @JsonProperty("emails") private val emails: List?, + @JsonProperty("encrypted_ssn") private val encryptedSsn: String?, + @JsonProperty("ethnicity") private val ethnicity: Ethnicity?, + @JsonProperty("first_name") private val firstName: String?, + @JsonProperty("gender") private val gender: Gender?, + @JsonProperty("last_name") private val lastName: String?, + @JsonProperty("middle_name") private val middleName: String?, + @JsonProperty("phone_numbers") private val phoneNumbers: List?, + @JsonProperty("preferred_name") private val preferredName: String?, + @JsonProperty("residence") private val residence: Location?, + @JsonProperty("ssn") private val ssn: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("dob") fun dob(): String? = dob + @JsonProperty("dob") fun dob(): Optional = Optional.ofNullable(dob) - @JsonProperty("emails") fun emails(): List? = emails + @JsonProperty("emails") fun emails(): Optional> = Optional.ofNullable(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 + @JsonProperty("encrypted_ssn") + fun encryptedSsn(): Optional = Optional.ofNullable(encryptedSsn) /** The EEOC-defined ethnicity of the individual. */ - @JsonProperty("ethnicity") fun ethnicity(): Ethnicity? = ethnicity + @JsonProperty("ethnicity") + fun ethnicity(): Optional = Optional.ofNullable(ethnicity) /** The legal first name of the individual. */ - @JsonProperty("first_name") fun firstName(): String? = firstName + @JsonProperty("first_name") + fun firstName(): Optional = Optional.ofNullable(firstName) /** The gender of the individual. */ - @JsonProperty("gender") fun gender(): Gender? = gender + @JsonProperty("gender") fun gender(): Optional = Optional.ofNullable(gender) /** The legal last name of the individual. */ - @JsonProperty("last_name") fun lastName(): String? = lastName + @JsonProperty("last_name") fun lastName(): Optional = Optional.ofNullable(lastName) /** The legal middle name of the individual. */ - @JsonProperty("middle_name") fun middleName(): String? = middleName + @JsonProperty("middle_name") + fun middleName(): Optional = Optional.ofNullable(middleName) - @JsonProperty("phone_numbers") fun phoneNumbers(): List? = phoneNumbers + @JsonProperty("phone_numbers") + fun phoneNumbers(): Optional> = Optional.ofNullable(phoneNumbers) /** The preferred name of the individual. */ - @JsonProperty("preferred_name") fun preferredName(): String? = preferredName + @JsonProperty("preferred_name") + fun preferredName(): Optional = Optional.ofNullable(preferredName) - @JsonProperty("residence") fun residence(): Location? = residence + @JsonProperty("residence") + fun residence(): Optional = Optional.ofNullable(residence) /** * Social Security Number of the individual. This field is only available with the `ssn` * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - @JsonProperty("ssn") fun ssn(): String? = ssn + @JsonProperty("ssn") fun ssn(): Optional = Optional.ofNullable(ssn) @JsonAnyGetter @ExcludeMissing @@ -174,14 +169,14 @@ constructor( class Builder { private var dob: String? = null - private var emails: List? = null + private var emails: MutableList? = 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 phoneNumbers: MutableList? = null private var preferredName: String? = null private var residence: Location? = null private var ssn: String? = null @@ -189,85 +184,134 @@ constructor( @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) + dob = sandboxIndividualUpdateBody.dob + emails = sandboxIndividualUpdateBody.emails?.toMutableList() + encryptedSsn = sandboxIndividualUpdateBody.encryptedSsn + ethnicity = sandboxIndividualUpdateBody.ethnicity + firstName = sandboxIndividualUpdateBody.firstName + gender = sandboxIndividualUpdateBody.gender + lastName = sandboxIndividualUpdateBody.lastName + middleName = sandboxIndividualUpdateBody.middleName + phoneNumbers = sandboxIndividualUpdateBody.phoneNumbers?.toMutableList() + preferredName = sandboxIndividualUpdateBody.preferredName + residence = sandboxIndividualUpdateBody.residence + ssn = sandboxIndividualUpdateBody.ssn + additionalProperties = + sandboxIndividualUpdateBody.additionalProperties.toMutableMap() } - @JsonProperty("dob") fun dob(dob: String) = apply { this.dob = dob } + fun dob(dob: String?) = apply { this.dob = dob } - @JsonProperty("emails") fun emails(emails: List) = apply { this.emails = emails } + fun dob(dob: Optional) = dob(dob.orElse(null)) + + fun emails(emails: List?) = apply { this.emails = emails?.toMutableList() } + + fun emails(emails: Optional>) = emails(emails.orElse(null)) + + fun addEmail(email: Email) = apply { + emails = (emails ?: mutableListOf()).apply { 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. */ - @JsonProperty("encrypted_ssn") - fun encryptedSsn(encryptedSsn: String) = apply { this.encryptedSsn = encryptedSsn } + fun encryptedSsn(encryptedSsn: String?) = apply { this.encryptedSsn = encryptedSsn } + + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param + * set in the body. + */ + fun encryptedSsn(encryptedSsn: Optional) = + encryptedSsn(encryptedSsn.orElse(null)) /** The EEOC-defined ethnicity of the individual. */ - @JsonProperty("ethnicity") - fun ethnicity(ethnicity: Ethnicity) = apply { this.ethnicity = ethnicity } + fun ethnicity(ethnicity: Ethnicity?) = apply { this.ethnicity = ethnicity } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) + + /** The legal first name of the individual. */ + fun firstName(firstName: String?) = apply { this.firstName = firstName } /** The legal first name of the individual. */ - @JsonProperty("first_name") - fun firstName(firstName: String) = apply { this.firstName = firstName } + fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) + + /** The gender of the individual. */ + fun gender(gender: Gender?) = apply { this.gender = gender } /** The gender of the individual. */ - @JsonProperty("gender") fun gender(gender: Gender) = apply { this.gender = gender } + fun gender(gender: Optional) = gender(gender.orElse(null)) + + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { this.lastName = lastName } /** The legal last name of the individual. */ - @JsonProperty("last_name") - fun lastName(lastName: String) = apply { this.lastName = lastName } + fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) /** The legal middle name of the individual. */ - @JsonProperty("middle_name") - fun middleName(middleName: String) = apply { this.middleName = middleName } + fun middleName(middleName: String?) = apply { this.middleName = middleName } - @JsonProperty("phone_numbers") - fun phoneNumbers(phoneNumbers: List) = apply { - this.phoneNumbers = phoneNumbers + /** The legal middle name of the individual. */ + fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) + + fun phoneNumbers(phoneNumbers: List?) = apply { + this.phoneNumbers = phoneNumbers?.toMutableList() + } + + fun phoneNumbers(phoneNumbers: Optional>) = + phoneNumbers(phoneNumbers.orElse(null)) + + fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { + phoneNumbers = (phoneNumbers ?: mutableListOf()).apply { add(phoneNumber) } } /** The preferred name of the individual. */ - @JsonProperty("preferred_name") - fun preferredName(preferredName: String) = apply { this.preferredName = preferredName } + fun preferredName(preferredName: String?) = apply { this.preferredName = preferredName } - @JsonProperty("residence") - fun residence(residence: Location) = apply { this.residence = residence } + /** The preferred name of the individual. */ + fun preferredName(preferredName: Optional) = + preferredName(preferredName.orElse(null)) + + fun residence(residence: Location?) = apply { this.residence = residence } + + fun residence(residence: Optional) = residence(residence.orElse(null)) /** * Social Security Number of the individual. This field is only available with the `ssn` * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - @JsonProperty("ssn") fun ssn(ssn: String) = apply { this.ssn = ssn } + fun ssn(ssn: String?) = apply { this.ssn = ssn } + + /** + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + */ + fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxIndividualUpdateBody = SandboxIndividualUpdateBody( dob, @@ -315,95 +359,108 @@ constructor( 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 body: SandboxIndividualUpdateBody.Builder = + SandboxIndividualUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxIndividualUpdateParams: SandboxIndividualUpdateParams) = apply { individualId = sandboxIndividualUpdateParams.individualId - dob = sandboxIndividualUpdateParams.dob - emails = sandboxIndividualUpdateParams.emails?.toMutableList() ?: mutableListOf() - encryptedSsn = sandboxIndividualUpdateParams.encryptedSsn - ethnicity = sandboxIndividualUpdateParams.ethnicity - firstName = sandboxIndividualUpdateParams.firstName - gender = sandboxIndividualUpdateParams.gender - lastName = sandboxIndividualUpdateParams.lastName - middleName = sandboxIndividualUpdateParams.middleName - phoneNumbers = - sandboxIndividualUpdateParams.phoneNumbers?.toMutableList() ?: mutableListOf() - preferredName = sandboxIndividualUpdateParams.preferredName - residence = sandboxIndividualUpdateParams.residence - ssn = sandboxIndividualUpdateParams.ssn + body = sandboxIndividualUpdateParams.body.toBuilder() additionalHeaders = sandboxIndividualUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxIndividualUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxIndividualUpdateParams.additionalBodyProperties.toMutableMap() } fun individualId(individualId: String) = apply { this.individualId = individualId } - fun dob(dob: String) = apply { this.dob = dob } + fun dob(dob: String?) = apply { body.dob(dob) } - fun emails(emails: List) = apply { - this.emails.clear() - this.emails.addAll(emails) - } + fun dob(dob: Optional) = dob(dob.orElse(null)) + + fun emails(emails: List?) = apply { body.emails(emails) } + + fun emails(emails: Optional>) = emails(emails.orElse(null)) - fun addEmail(email: Email) = apply { this.emails.add(email) } + fun addEmail(email: Email) = apply { body.addEmail(email) } /** * Social Security Number of the individual in **encrypted** format. This field is only * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set * in the body. */ - fun encryptedSsn(encryptedSsn: String) = apply { this.encryptedSsn = encryptedSsn } + fun encryptedSsn(encryptedSsn: String?) = apply { body.encryptedSsn(encryptedSsn) } + + /** + * Social Security Number of the individual in **encrypted** format. This field is only + * available with the `ssn` scope enabled and the `options: { include: ['ssn'] }` param set + * in the body. + */ + fun encryptedSsn(encryptedSsn: Optional) = encryptedSsn(encryptedSsn.orElse(null)) /** The EEOC-defined ethnicity of the individual. */ - fun ethnicity(ethnicity: Ethnicity) = apply { this.ethnicity = ethnicity } + fun ethnicity(ethnicity: Ethnicity?) = apply { body.ethnicity(ethnicity) } + + /** The EEOC-defined ethnicity of the individual. */ + fun ethnicity(ethnicity: Optional) = ethnicity(ethnicity.orElse(null)) /** The legal first name of the individual. */ - fun firstName(firstName: String) = apply { this.firstName = firstName } + fun firstName(firstName: String?) = apply { body.firstName(firstName) } + + /** The legal first name of the individual. */ + fun firstName(firstName: Optional) = firstName(firstName.orElse(null)) /** The gender of the individual. */ - fun gender(gender: Gender) = apply { this.gender = gender } + fun gender(gender: Gender?) = apply { body.gender(gender) } + + /** The gender of the individual. */ + fun gender(gender: Optional) = gender(gender.orElse(null)) + + /** The legal last name of the individual. */ + fun lastName(lastName: String?) = apply { body.lastName(lastName) } /** The legal last name of the individual. */ - fun lastName(lastName: String) = apply { this.lastName = lastName } + fun lastName(lastName: Optional) = lastName(lastName.orElse(null)) + + /** The legal middle name of the individual. */ + fun middleName(middleName: String?) = apply { body.middleName(middleName) } /** The legal middle name of the individual. */ - fun middleName(middleName: String) = apply { this.middleName = middleName } + fun middleName(middleName: Optional) = middleName(middleName.orElse(null)) - fun phoneNumbers(phoneNumbers: List) = apply { - this.phoneNumbers.clear() - this.phoneNumbers.addAll(phoneNumbers) + fun phoneNumbers(phoneNumbers: List?) = apply { + body.phoneNumbers(phoneNumbers) } - fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { this.phoneNumbers.add(phoneNumber) } + fun phoneNumbers(phoneNumbers: Optional>) = + phoneNumbers(phoneNumbers.orElse(null)) + + fun addPhoneNumber(phoneNumber: PhoneNumber) = apply { body.addPhoneNumber(phoneNumber) } + + /** The preferred name of the individual. */ + fun preferredName(preferredName: String?) = apply { body.preferredName(preferredName) } /** The preferred name of the individual. */ - fun preferredName(preferredName: String) = apply { this.preferredName = preferredName } + fun preferredName(preferredName: Optional) = + preferredName(preferredName.orElse(null)) - fun residence(residence: Location) = apply { this.residence = residence } + fun residence(residence: Location?) = apply { body.residence(residence) } + + fun residence(residence: Optional) = residence(residence.orElse(null)) /** * Social Security Number of the individual. This field is only available with the `ssn` * scope enabled and the `options: { include: ['ssn'] }` param set in the body. * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). */ - fun ssn(ssn: String) = apply { this.ssn = ssn } + fun ssn(ssn: String?) = apply { body.ssn(ssn) } + + /** + * Social Security Number of the individual. This field is only available with the `ssn` + * scope enabled and the `options: { include: ['ssn'] }` param set in the body. + * [Click here to learn more about enabling the SSN field](/developer-resources/Enable-SSN-Field). + */ + fun ssn(ssn: Optional) = ssn(ssn.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -504,60 +561,46 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxIndividualUpdateParams = SandboxIndividualUpdateParams( checkNotNull(individualId) { "`individualId` is required but was not set" }, - dob, - emails.toImmutable().ifEmpty { null }, - encryptedSsn, - ethnicity, - firstName, - gender, - lastName, - middleName, - phoneNumbers.toImmutable().ifEmpty { null }, - preferredName, - residence, - ssn, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = Email.Builder::class) @NoAutoDetect class Email + @JsonCreator private constructor( - private val data: String?, - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("data") private val data: String?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("data") fun data(): String? = data + @JsonProperty("data") fun data(): Optional = Optional.ofNullable(data) - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -578,29 +621,38 @@ constructor( @JvmSynthetic internal fun from(email: Email) = apply { - this.data = email.data - this.type = email.type - additionalProperties(email.additionalProperties) + data = email.data + type = email.type + additionalProperties = email.additionalProperties.toMutableMap() } - @JsonProperty("data") fun data(data: String) = apply { this.data = data } + fun data(data: String?) = apply { this.data = data } + + fun data(data: Optional) = data(data.orElse(null)) - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun type(type: Type?) = apply { this.type = type } + + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Email = Email( data, @@ -847,18 +899,19 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = PhoneNumber.Builder::class) @NoAutoDetect class PhoneNumber + @JsonCreator private constructor( - private val data: String?, - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("data") private val data: String?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("data") fun data(): String? = data + @JsonProperty("data") fun data(): Optional = Optional.ofNullable(data) - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -879,29 +932,38 @@ constructor( @JvmSynthetic internal fun from(phoneNumber: PhoneNumber) = apply { - this.data = phoneNumber.data - this.type = phoneNumber.type - additionalProperties(phoneNumber.additionalProperties) + data = phoneNumber.data + type = phoneNumber.type + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - @JsonProperty("data") fun data(data: String) = apply { this.data = data } + fun data(data: String?) = apply { this.data = data } + + fun data(data: Optional) = data(data.orElse(null)) - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun type(type: Type?) = apply { this.type = type } + + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PhoneNumber = PhoneNumber( data, @@ -990,11 +1052,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxIndividualUpdateParams && individualId == other.individualId && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxIndividualUpdateParams && individualId == other.individualId && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualId, dob, emails, encryptedSsn, ethnicity, firstName, gender, lastName, middleName, phoneNumbers, preferredName, residence, ssn, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualId, body, additionalHeaders, additionalQueryParams) /* spotless:on */ 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, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxIndividualUpdateParams{individualId=$individualId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index 1412fc7a..395bd5c9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -6,44 +6,46 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects -@JsonDeserialize(builder = SandboxJobConfiguration.Builder::class) @NoAutoDetect class SandboxJobConfiguration +@JsonCreator private constructor( - private val type: JsonField, - private val completionStatus: JsonField, - private val additionalProperties: Map, + @JsonProperty("completion_status") + @ExcludeMissing + private val completionStatus: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + fun completionStatus(): CompletionStatus = completionStatus.getRequired("completion_status") fun type(): Type = type.getRequired("type") - fun completionStatus(): CompletionStatus = completionStatus.getRequired("completion_status") + @JsonProperty("completion_status") @ExcludeMissing fun _completionStatus() = completionStatus @JsonProperty("type") @ExcludeMissing fun _type() = type - @JsonProperty("completion_status") @ExcludeMissing fun _completionStatus() = completionStatus - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SandboxJobConfiguration = apply { if (!validated) { - type() completionStatus() + type() validated = true } } @@ -57,50 +59,51 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() private var completionStatus: JsonField = JsonMissing.of() + private var type: 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) + completionStatus = sandboxJobConfiguration.completionStatus + type = sandboxJobConfiguration.type + additionalProperties = sandboxJobConfiguration.additionalProperties.toMutableMap() } - 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 type(type: Type) = type(JsonField.of(type)) + + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxJobConfiguration = SandboxJobConfiguration( - type, completionStatus, + type, additionalProperties.toImmutable(), ) } @@ -230,15 +233,15 @@ private constructor( return true } - return /* spotless:off */ other is SandboxJobConfiguration && type == other.type && completionStatus == other.completionStatus && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SandboxJobConfiguration && completionStatus == other.completionStatus && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, completionStatus, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(completionStatus, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SandboxJobConfiguration{type=$type, completionStatus=$completionStatus, additionalProperties=$additionalProperties}" + "SandboxJobConfiguration{completionStatus=$completionStatus, type=$type, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt index cca375a1..745f1e13 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,55 +13,48 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects class SandboxJobConfigurationUpdateParams constructor( - private val completionStatus: CompletionStatus, - private val type: Type, + private val body: SandboxJobConfigurationUpdateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun completionStatus(): CompletionStatus = completionStatus + fun completionStatus(): CompletionStatus = body.completionStatus() - fun type(): Type = type + fun type(): Type = body.type() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SandboxJobConfigurationUpdateBody { - return SandboxJobConfigurationUpdateBody( - completionStatus, - type, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): SandboxJobConfigurationUpdateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = SandboxJobConfigurationUpdateBody.Builder::class) @NoAutoDetect class SandboxJobConfigurationUpdateBody + @JsonCreator internal constructor( - private val completionStatus: CompletionStatus?, - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("completion_status") private val completionStatus: CompletionStatus, + @JsonProperty("type") private val type: Type, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { @JsonProperty("completion_status") - fun completionStatus(): CompletionStatus? = completionStatus + fun completionStatus(): CompletionStatus = completionStatus - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Type = type @JsonAnyGetter @ExcludeMissing @@ -85,32 +77,37 @@ constructor( internal fun from( sandboxJobConfigurationUpdateBody: SandboxJobConfigurationUpdateBody ) = apply { - this.completionStatus = sandboxJobConfigurationUpdateBody.completionStatus - this.type = sandboxJobConfigurationUpdateBody.type - additionalProperties(sandboxJobConfigurationUpdateBody.additionalProperties) + completionStatus = sandboxJobConfigurationUpdateBody.completionStatus + type = sandboxJobConfigurationUpdateBody.type + additionalProperties = + sandboxJobConfigurationUpdateBody.additionalProperties.toMutableMap() } - @JsonProperty("completion_status") fun completionStatus(completionStatus: CompletionStatus) = apply { this.completionStatus = completionStatus } - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxJobConfigurationUpdateBody = SandboxJobConfigurationUpdateBody( checkNotNull(completionStatus) { @@ -149,30 +146,26 @@ constructor( @NoAutoDetect class Builder { - private var completionStatus: CompletionStatus? = null - private var type: Type? = null + private var body: SandboxJobConfigurationUpdateBody.Builder = + SandboxJobConfigurationUpdateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( sandboxJobConfigurationUpdateParams: SandboxJobConfigurationUpdateParams ) = apply { - completionStatus = sandboxJobConfigurationUpdateParams.completionStatus - type = sandboxJobConfigurationUpdateParams.type + body = sandboxJobConfigurationUpdateParams.body.toBuilder() additionalHeaders = sandboxJobConfigurationUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxJobConfigurationUpdateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxJobConfigurationUpdateParams.additionalBodyProperties.toMutableMap() } fun completionStatus(completionStatus: CompletionStatus) = apply { - this.completionStatus = completionStatus + body.completionStatus(completionStatus) } - fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { body.type(type) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -273,34 +266,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxJobConfigurationUpdateParams = SandboxJobConfigurationUpdateParams( - checkNotNull(completionStatus) { "`completionStatus` is required but was not set" }, - checkNotNull(type) { "`type` is required but was not set" }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -429,11 +417,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxJobConfigurationUpdateParams && completionStatus == other.completionStatus && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxJobConfigurationUpdateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(completionStatus, type, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxJobConfigurationUpdateParams{completionStatus=$completionStatus, type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxJobConfigurationUpdateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index 5cbc45ea..09ceb3b3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,45 +13,44 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects class SandboxJobCreateParams constructor( - private val type: Type, + private val body: SandboxJobCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun type(): Type = type + /** The type of job to start. Currently the only supported type is `data_sync_all` */ + fun type(): Type = body.type() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SandboxJobCreateBody { - return SandboxJobCreateBody(type, additionalBodyProperties) - } + @JvmSynthetic internal fun getBody(): SandboxJobCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(builder = SandboxJobCreateBody.Builder::class) @NoAutoDetect class SandboxJobCreateBody + @JsonCreator internal constructor( - private val type: Type?, - private val additionalProperties: Map, + @JsonProperty("type") private val type: Type, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { /** The type of job to start. Currently the only supported type is `data_sync_all` */ - @JsonProperty("type") fun type(): Type? = type + @JsonProperty("type") fun type(): Type = type @JsonAnyGetter @ExcludeMissing @@ -72,27 +70,32 @@ constructor( @JvmSynthetic internal fun from(sandboxJobCreateBody: SandboxJobCreateBody) = apply { - this.type = sandboxJobCreateBody.type - additionalProperties(sandboxJobCreateBody.additionalProperties) + type = sandboxJobCreateBody.type + additionalProperties = sandboxJobCreateBody.additionalProperties.toMutableMap() } /** The type of job to start. Currently the only supported type is `data_sync_all` */ - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { this.type = type } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxJobCreateBody = SandboxJobCreateBody( checkNotNull(type) { "`type` is required but was not set" }, @@ -128,22 +131,19 @@ constructor( @NoAutoDetect class Builder { - private var type: Type? = null + private var body: SandboxJobCreateBody.Builder = SandboxJobCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxJobCreateParams: SandboxJobCreateParams) = apply { - type = sandboxJobCreateParams.type + body = sandboxJobCreateParams.body.toBuilder() additionalHeaders = sandboxJobCreateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxJobCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxJobCreateParams.additionalBodyProperties.toMutableMap() } /** The type of job to start. Currently the only supported type is `data_sync_all` */ - fun type(type: Type) = apply { this.type = type } + fun type(type: Type) = apply { body.type(type) } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -244,33 +244,29 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxJobCreateParams = SandboxJobCreateParams( - checkNotNull(type) { "`type` is required but was not set" }, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } @@ -330,11 +326,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxJobCreateParams && type == other.type && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxJobCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(type, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxJobCreateParams{type=$type, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxJobCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index fedfbba1..11ef1439 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -6,7 +6,6 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField @@ -14,6 +13,7 @@ import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects @@ -21,35 +21,24 @@ import java.util.Optional class SandboxPaymentCreateParams constructor( - private val endDate: String?, - private val payStatements: List?, - private val startDate: String?, + private val body: SandboxPaymentCreateBody, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) { - fun endDate(): Optional = Optional.ofNullable(endDate) + fun endDate(): Optional = body.endDate() - fun payStatements(): Optional> = Optional.ofNullable(payStatements) + fun payStatements(): Optional> = body.payStatements() - fun startDate(): Optional = Optional.ofNullable(startDate) + fun startDate(): Optional = body.startDate() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - fun _additionalBodyProperties(): Map = additionalBodyProperties + fun _additionalBodyProperties(): Map = body._additionalProperties() - @JvmSynthetic - internal fun getBody(): SandboxPaymentCreateBody { - return SandboxPaymentCreateBody( - endDate, - payStatements, - startDate, - additionalBodyProperties, - ) - } + @JvmSynthetic internal fun getBody(): SandboxPaymentCreateBody = body @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders @@ -59,21 +48,24 @@ constructor( * Fields to configure the payment. Takes all fields from the `/payment` endpoint. All fields * are optional. */ - @JsonDeserialize(builder = SandboxPaymentCreateBody.Builder::class) @NoAutoDetect class SandboxPaymentCreateBody + @JsonCreator internal constructor( - private val endDate: String?, - private val payStatements: List?, - private val startDate: String?, - private val additionalProperties: Map, + @JsonProperty("end_date") private val endDate: String?, + @JsonProperty("pay_statements") private val payStatements: List?, + @JsonProperty("start_date") private val startDate: String?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - @JsonProperty("end_date") fun endDate(): String? = endDate + @JsonProperty("end_date") fun endDate(): Optional = Optional.ofNullable(endDate) - @JsonProperty("pay_statements") fun payStatements(): List? = payStatements + @JsonProperty("pay_statements") + fun payStatements(): Optional> = Optional.ofNullable(payStatements) - @JsonProperty("start_date") fun startDate(): String? = startDate + @JsonProperty("start_date") + fun startDate(): Optional = Optional.ofNullable(startDate) @JsonAnyGetter @ExcludeMissing @@ -89,43 +81,56 @@ constructor( class Builder { private var endDate: String? = null - private var payStatements: List? = null + private var payStatements: MutableList? = 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) + endDate = sandboxPaymentCreateBody.endDate + payStatements = sandboxPaymentCreateBody.payStatements?.toMutableList() + startDate = sandboxPaymentCreateBody.startDate + additionalProperties = sandboxPaymentCreateBody.additionalProperties.toMutableMap() + } + + fun endDate(endDate: String?) = apply { this.endDate = endDate } + + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) + + fun payStatements(payStatements: List?) = apply { + this.payStatements = payStatements?.toMutableList() } - @JsonProperty("end_date") - fun endDate(endDate: String) = apply { this.endDate = endDate } + fun payStatements(payStatements: Optional>) = + payStatements(payStatements.orElse(null)) - @JsonProperty("pay_statements") - fun payStatements(payStatements: List) = apply { - this.payStatements = payStatements + fun addPayStatement(payStatement: PayStatement) = apply { + payStatements = (payStatements ?: mutableListOf()).apply { add(payStatement) } } - @JsonProperty("start_date") - fun startDate(startDate: String) = apply { this.startDate = startDate } + fun startDate(startDate: String?) = apply { this.startDate = startDate } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SandboxPaymentCreateBody = SandboxPaymentCreateBody( endDate, @@ -163,37 +168,35 @@ constructor( @NoAutoDetect class Builder { - private var endDate: String? = null - private var payStatements: MutableList = mutableListOf() - private var startDate: String? = null + private var body: SandboxPaymentCreateBody.Builder = SandboxPaymentCreateBody.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sandboxPaymentCreateParams: SandboxPaymentCreateParams) = apply { - endDate = sandboxPaymentCreateParams.endDate - payStatements = - sandboxPaymentCreateParams.payStatements?.toMutableList() ?: mutableListOf() - startDate = sandboxPaymentCreateParams.startDate + body = sandboxPaymentCreateParams.body.toBuilder() additionalHeaders = sandboxPaymentCreateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxPaymentCreateParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - sandboxPaymentCreateParams.additionalBodyProperties.toMutableMap() } - fun endDate(endDate: String) = apply { this.endDate = endDate } + fun endDate(endDate: String?) = apply { body.endDate(endDate) } + + fun endDate(endDate: Optional) = endDate(endDate.orElse(null)) - fun payStatements(payStatements: List) = apply { - this.payStatements.clear() - this.payStatements.addAll(payStatements) + fun payStatements(payStatements: List?) = apply { + body.payStatements(payStatements) } + fun payStatements(payStatements: Optional>) = + payStatements(payStatements.orElse(null)) + fun addPayStatement(payStatement: PayStatement) = apply { - this.payStatements.add(payStatement) + body.addPayStatement(payStatement) } - fun startDate(startDate: String) = apply { this.startDate = startDate } + fun startDate(startDate: String?) = apply { body.startDate(startDate) } + + fun startDate(startDate: Optional) = startDate(startDate.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -294,83 +297,86 @@ constructor( } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) + body.additionalProperties(additionalBodyProperties) } fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) + body.putAdditionalProperty(key, value) } fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) + body.putAllAdditionalProperties(additionalBodyProperties) } - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) + body.removeAllAdditionalProperties(keys) } fun build(): SandboxPaymentCreateParams = SandboxPaymentCreateParams( - endDate, - payStatements.toImmutable().ifEmpty { null }, - startDate, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - @JsonDeserialize(builder = PayStatement.Builder::class) @NoAutoDetect class PayStatement + @JsonCreator 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?, + @JsonProperty("earnings") private val earnings: List?, + @JsonProperty("employee_deductions") private val employeeDeductions: List?, + @JsonProperty("employer_contributions") private val employerContributions: List?, - private val additionalProperties: Map, + @JsonProperty("gross_pay") private val grossPay: Money?, + @JsonProperty("individual_id") private val individualId: String?, + @JsonProperty("net_pay") private val netPay: Money?, + @JsonProperty("payment_method") private val paymentMethod: PaymentMethod?, + @JsonProperty("taxes") private val taxes: List?, + @JsonProperty("total_hours") private val totalHours: Double?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** A stable Finch `id` (UUID v4) for an individual in the company */ - @JsonProperty("individual_id") fun individualId(): String? = individualId + /** The array of earnings objects associated with this pay statement */ + @JsonProperty("earnings") + fun earnings(): Optional> = Optional.ofNullable(earnings) - /** The type of the payment associated with the pay statement. */ - @JsonProperty("type") fun type(): Type? = type + /** The array of deductions objects associated with this pay statement. */ + @JsonProperty("employee_deductions") + fun employeeDeductions(): Optional> = + Optional.ofNullable(employeeDeductions) - /** The payment method. */ - @JsonProperty("payment_method") fun paymentMethod(): PaymentMethod? = paymentMethod + @JsonProperty("employer_contributions") + fun employerContributions(): Optional> = + Optional.ofNullable(employerContributions) - /** The number of hours worked for this pay period */ - @JsonProperty("total_hours") fun totalHours(): Double? = totalHours + @JsonProperty("gross_pay") fun grossPay(): Optional = Optional.ofNullable(grossPay) - @JsonProperty("gross_pay") fun grossPay(): Money? = grossPay + /** A stable Finch `id` (UUID v4) for an individual in the company */ + @JsonProperty("individual_id") + fun individualId(): Optional = Optional.ofNullable(individualId) - @JsonProperty("net_pay") fun netPay(): Money? = netPay + @JsonProperty("net_pay") fun netPay(): Optional = Optional.ofNullable(netPay) - /** The array of earnings objects associated with this pay statement */ - @JsonProperty("earnings") fun earnings(): List? = earnings + /** The payment method. */ + @JsonProperty("payment_method") + fun paymentMethod(): Optional = Optional.ofNullable(paymentMethod) /** The array of taxes objects associated with this pay statement. */ - @JsonProperty("taxes") fun taxes(): List? = taxes + @JsonProperty("taxes") fun taxes(): Optional> = Optional.ofNullable(taxes) - /** The array of deductions objects associated with this pay statement. */ - @JsonProperty("employee_deductions") - fun employeeDeductions(): List? = employeeDeductions + /** The number of hours worked for this pay period */ + @JsonProperty("total_hours") + fun totalHours(): Optional = Optional.ofNullable(totalHours) - @JsonProperty("employer_contributions") - fun employerContributions(): List? = employerContributions + /** The type of the payment associated with the pay statement. */ + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -385,132 +391,190 @@ constructor( class Builder { + private var earnings: MutableList? = null + private var employeeDeductions: MutableList? = null + private var employerContributions: MutableList? = null + private var grossPay: Money? = null private var individualId: String? = null - private var type: Type? = null + private var netPay: Money? = null private var paymentMethod: PaymentMethod? = null + private var taxes: MutableList? = 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 type: Type? = 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) + earnings = payStatement.earnings?.toMutableList() + employeeDeductions = payStatement.employeeDeductions?.toMutableList() + employerContributions = payStatement.employerContributions?.toMutableList() + grossPay = payStatement.grossPay + individualId = payStatement.individualId + netPay = payStatement.netPay + paymentMethod = payStatement.paymentMethod + taxes = payStatement.taxes?.toMutableList() + totalHours = payStatement.totalHours + type = payStatement.type + additionalProperties = payStatement.additionalProperties.toMutableMap() + } + + /** The array of earnings objects associated with this pay statement */ + fun earnings(earnings: List?) = apply { + this.earnings = earnings?.toMutableList() + } + + /** The array of earnings objects associated with this pay statement */ + fun earnings(earnings: Optional>) = earnings(earnings.orElse(null)) + + /** The array of earnings objects associated with this pay statement */ + fun addEarning(earning: Earning) = apply { + earnings = (earnings ?: mutableListOf()).apply { add(earning) } } + /** The array of deductions objects associated with this pay statement. */ + fun employeeDeductions(employeeDeductions: List?) = apply { + this.employeeDeductions = employeeDeductions?.toMutableList() + } + + /** The array of deductions objects associated with this pay statement. */ + fun employeeDeductions(employeeDeductions: Optional>) = + employeeDeductions(employeeDeductions.orElse(null)) + + /** The array of deductions objects associated with this pay statement. */ + fun addEmployeeDeduction(employeeDeduction: EmployeeDeduction) = apply { + employeeDeductions = + (employeeDeductions ?: mutableListOf()).apply { add(employeeDeduction) } + } + + fun employerContributions(employerContributions: List?) = apply { + this.employerContributions = employerContributions?.toMutableList() + } + + fun employerContributions( + employerContributions: Optional> + ) = employerContributions(employerContributions.orElse(null)) + + fun addEmployerContribution(employerContribution: EmployerContribution) = apply { + employerContributions = + (employerContributions ?: mutableListOf()).apply { add(employerContribution) } + } + + fun grossPay(grossPay: Money?) = apply { this.grossPay = grossPay } + + fun grossPay(grossPay: Optional) = grossPay(grossPay.orElse(null)) + /** A stable Finch `id` (UUID v4) for an individual in the company */ - @JsonProperty("individual_id") - fun individualId(individualId: String) = apply { this.individualId = individualId } + 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 } + /** A stable Finch `id` (UUID v4) for an individual in the company */ + fun individualId(individualId: Optional) = + individualId(individualId.orElse(null)) + + fun netPay(netPay: Money?) = apply { this.netPay = netPay } + + fun netPay(netPay: Optional) = netPay(netPay.orElse(null)) /** The payment method. */ - @JsonProperty("payment_method") - fun paymentMethod(paymentMethod: PaymentMethod) = apply { + 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 } + /** The payment method. */ + fun paymentMethod(paymentMethod: Optional) = + paymentMethod(paymentMethod.orElse(null)) - @JsonProperty("net_pay") fun netPay(netPay: Money) = apply { this.netPay = netPay } + /** The array of taxes objects associated with this pay statement. */ + fun taxes(taxes: List?) = apply { this.taxes = taxes?.toMutableList() } - /** 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. */ + fun taxes(taxes: Optional>) = taxes(taxes.orElse(null)) /** The array of taxes objects associated with this pay statement. */ - @JsonProperty("taxes") fun taxes(taxes: List) = apply { this.taxes = taxes } + fun addTax(tax: Tax) = apply { taxes = (taxes ?: mutableListOf()).apply { add(tax) } } - /** The array of deductions objects associated with this pay statement. */ - @JsonProperty("employee_deductions") - fun employeeDeductions(employeeDeductions: List) = apply { - this.employeeDeductions = employeeDeductions - } + /** The number of hours worked for this pay period */ + fun totalHours(totalHours: Double?) = apply { this.totalHours = totalHours } - @JsonProperty("employer_contributions") - fun employerContributions(employerContributions: List) = apply { - this.employerContributions = employerContributions - } + /** The number of hours worked for this pay period */ + fun totalHours(totalHours: Double) = totalHours(totalHours as Double?) + + /** The number of hours worked for this pay period */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun totalHours(totalHours: Optional) = + totalHours(totalHours.orElse(null) as Double?) + + /** The type of the payment associated with the pay statement. */ + fun type(type: Type?) = apply { this.type = type } + + /** The type of the payment associated with the pay statement. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): PayStatement = PayStatement( - individualId, - type, - paymentMethod, - totalHours, - grossPay, - netPay, earnings?.toImmutable(), - taxes?.toImmutable(), employeeDeductions?.toImmutable(), employerContributions?.toImmutable(), + grossPay, + individualId, + netPay, + paymentMethod, + taxes?.toImmutable(), + totalHours, + type, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Earning.Builder::class) @NoAutoDetect class Earning + @JsonCreator 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, + @JsonProperty("amount") private val amount: Long?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("hours") private val hours: Double?, + @JsonProperty("name") private val name: String?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** 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 + @JsonProperty("amount") fun amount(): Optional = Optional.ofNullable(amount) /** The earnings currency code. */ - @JsonProperty("currency") fun currency(): String? = currency + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(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 + @JsonProperty("hours") fun hours(): Optional = Optional.ofNullable(hours) + + /** The exact name of the deduction from the pay statement. */ + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) + + /** The type of earning. */ + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -525,50 +589,77 @@ constructor( 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 name: String? = null + private var type: Type? = 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) + amount = earning.amount + currency = earning.currency + hours = earning.hours + name = earning.name + type = earning.type + additionalProperties = earning.additionalProperties.toMutableMap() } - /** The type of earning. */ - @JsonProperty("type") fun type(type: Type) = apply { this.type = type } + /** The earnings amount in cents. */ + fun amount(amount: Long?) = apply { this.amount = amount } - /** 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. */ + fun amount(amount: Long) = amount(amount as Long?) /** The earnings amount in cents. */ - @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + + /** The earnings currency code. */ + fun currency(currency: String?) = apply { this.currency = currency } /** The earnings currency code. */ - @JsonProperty("currency") - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** + * 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). + */ + fun hours(hours: Double?) = apply { this.hours = hours } + + /** + * The number of hours associated with this earning. (For salaried employees, this + * could be hours per pay period, `0` or `null`, depending on the provider). + */ + fun hours(hours: Double) = hours(hours as Double?) /** * The number of hours associated with this earning. (For salaried employees, this * could be hours per pay period, `0` or `null`, depending on the provider). */ - @JsonProperty("hours") fun hours(hours: Double) = apply { this.hours = hours } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun hours(hours: Optional) = hours(hours.orElse(null) as Double?) + + /** The exact name of the deduction from the pay statement. */ + fun name(name: String?) = apply { this.name = name } + + /** The exact name of the deduction from the pay statement. */ + fun name(name: Optional) = name(name.orElse(null)) + + /** The type of earning. */ + fun type(type: Type?) = apply { this.type = type } + + /** The type of earning. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -576,13 +667,21 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Earning = Earning( - type, - name, amount, currency, hours, + name, + type, additionalProperties.toImmutable(), ) } @@ -715,45 +814,47 @@ constructor( return true } - return /* spotless:off */ other is Earning && type == other.type && name == other.name && amount == other.amount && currency == other.currency && hours == other.hours && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Earning && amount == other.amount && currency == other.currency && hours == other.hours && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, amount, currency, hours, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, hours, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Earning{type=$type, name=$name, amount=$amount, currency=$currency, hours=$hours, additionalProperties=$additionalProperties}" + "Earning{amount=$amount, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployeeDeduction.Builder::class) @NoAutoDetect class EmployeeDeduction + @JsonCreator 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, + @JsonProperty("amount") private val amount: Long?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("name") private val name: String?, + @JsonProperty("pre_tax") private val preTax: Boolean?, + @JsonProperty("type") private val type: BenefitType?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The deduction name from the pay statement. */ - @JsonProperty("name") fun name(): String? = name - /** The deduction amount in cents. */ - @JsonProperty("amount") fun amount(): Long? = amount + @JsonProperty("amount") fun amount(): Optional = Optional.ofNullable(amount) /** The deduction currency. */ - @JsonProperty("currency") fun currency(): String? = currency + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** The deduction name from the pay statement. */ + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) /** Boolean indicating if the deduction is pre-tax. */ - @JsonProperty("pre_tax") fun preTax(): Boolean? = preTax + @JsonProperty("pre_tax") fun preTax(): Optional = Optional.ofNullable(preTax) /** Type of benefit. */ - @JsonProperty("type") fun type(): BenefitType? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -768,48 +869,68 @@ constructor( class Builder { - private var name: String? = null private var amount: Long? = null private var currency: String? = null + private var name: 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) + amount = employeeDeduction.amount + currency = employeeDeduction.currency + name = employeeDeduction.name + preTax = employeeDeduction.preTax + type = employeeDeduction.type + additionalProperties = employeeDeduction.additionalProperties.toMutableMap() } - /** The deduction name from the pay statement. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + /** The deduction amount in cents. */ + fun amount(amount: Long?) = apply { this.amount = amount } /** The deduction amount in cents. */ - @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + fun amount(amount: Long) = amount(amount as Long?) + + /** The deduction amount in cents. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + + /** The deduction currency. */ + fun currency(currency: String?) = apply { this.currency = currency } /** The deduction currency. */ - @JsonProperty("currency") - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** The deduction name from the pay statement. */ + fun name(name: String?) = apply { this.name = name } + + /** The deduction name from the pay statement. */ + fun name(name: Optional) = name(name.orElse(null)) /** Boolean indicating if the deduction is pre-tax. */ - @JsonProperty("pre_tax") - fun preTax(preTax: Boolean) = apply { this.preTax = preTax } + fun preTax(preTax: Boolean?) = apply { this.preTax = preTax } + + /** Boolean indicating if the deduction is pre-tax. */ + fun preTax(preTax: Boolean) = preTax(preTax as Boolean?) + + /** Boolean indicating if the deduction is pre-tax. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun preTax(preTax: Optional) = preTax(preTax.orElse(null) as Boolean?) /** Type of benefit. */ - @JsonProperty("type") fun type(type: BenefitType) = apply { this.type = type } + fun type(type: BenefitType?) = apply { this.type = type } + + /** Type of benefit. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -817,11 +938,19 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployeeDeduction = EmployeeDeduction( - name, amount, currency, + name, preTax, type, additionalProperties.toImmutable(), @@ -833,41 +962,43 @@ constructor( return true } - return /* spotless:off */ other is EmployeeDeduction && name == other.name && amount == other.amount && currency == other.currency && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployeeDeduction && amount == other.amount && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, currency, preTax, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, preTax, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployeeDeduction{name=$name, amount=$amount, currency=$currency, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" + "EmployeeDeduction{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } - @JsonDeserialize(builder = EmployerContribution.Builder::class) @NoAutoDetect class EmployerContribution + @JsonCreator private constructor( - private val name: String?, - private val amount: Long?, - private val currency: String?, - private val type: BenefitType?, - private val additionalProperties: Map, + @JsonProperty("amount") private val amount: Long?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("name") private val name: String?, + @JsonProperty("type") private val type: BenefitType?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The contribution name from the pay statement. */ - @JsonProperty("name") fun name(): String? = name - /** The contribution amount in cents. */ - @JsonProperty("amount") fun amount(): Long? = amount + @JsonProperty("amount") fun amount(): Optional = Optional.ofNullable(amount) /** The contribution currency. */ - @JsonProperty("currency") fun currency(): String? = currency + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) + + /** The contribution name from the pay statement. */ + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) /** Type of benefit. */ - @JsonProperty("type") fun type(): BenefitType? = type + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -882,42 +1013,56 @@ constructor( class Builder { - private var name: String? = null private var amount: Long? = null private var currency: String? = null + private var name: 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) + amount = employerContribution.amount + currency = employerContribution.currency + name = employerContribution.name + type = employerContribution.type + additionalProperties = employerContribution.additionalProperties.toMutableMap() } - /** The contribution name from the pay statement. */ - @JsonProperty("name") fun name(name: String) = apply { this.name = name } + /** The contribution amount in cents. */ + fun amount(amount: Long?) = apply { this.amount = amount } + + /** The contribution amount in cents. */ + fun amount(amount: Long) = amount(amount as Long?) /** The contribution amount in cents. */ - @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + + /** The contribution currency. */ + fun currency(currency: String?) = apply { this.currency = currency } /** The contribution currency. */ - @JsonProperty("currency") - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** The contribution name from the pay statement. */ + fun name(name: String?) = apply { this.name = name } + + /** The contribution name from the pay statement. */ + fun name(name: Optional) = name(name.orElse(null)) + + /** Type of benefit. */ + fun type(type: BenefitType?) = apply { this.type = type } /** Type of benefit. */ - @JsonProperty("type") fun type(type: BenefitType) = apply { this.type = type } + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -925,11 +1070,19 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): EmployerContribution = EmployerContribution( - name, amount, currency, + name, type, additionalProperties.toImmutable(), ) @@ -940,17 +1093,17 @@ constructor( return true } - return /* spotless:off */ other is EmployerContribution && name == other.name && amount == other.amount && currency == other.currency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployerContribution && amount == other.amount && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, amount, currency, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployerContribution{name=$name, amount=$amount, currency=$currency, type=$type, additionalProperties=$additionalProperties}" + "EmployerContribution{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" } class PaymentMethod @@ -1010,32 +1163,35 @@ constructor( override fun toString() = value.toString() } - @JsonDeserialize(builder = Tax.Builder::class) @NoAutoDetect class Tax + @JsonCreator 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, + @JsonProperty("amount") private val amount: Long?, + @JsonProperty("currency") private val currency: String?, + @JsonProperty("employer") private val employer: Boolean?, + @JsonProperty("name") private val name: String?, + @JsonProperty("type") private val type: Type?, + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - /** The type of taxes. */ - @JsonProperty("type") fun type(): Type? = type + /** The tax amount in cents. */ + @JsonProperty("amount") fun amount(): Optional = Optional.ofNullable(amount) - /** The exact name of tax from the pay statement. */ - @JsonProperty("name") fun name(): String? = name + /** The currency code. */ + @JsonProperty("currency") + fun currency(): Optional = Optional.ofNullable(currency) /** `true` if the amount is paid by the employers. */ - @JsonProperty("employer") fun employer(): Boolean? = employer + @JsonProperty("employer") + fun employer(): Optional = Optional.ofNullable(employer) - /** The tax amount in cents. */ - @JsonProperty("amount") fun amount(): Long? = amount + /** The exact name of tax from the pay statement. */ + @JsonProperty("name") fun name(): Optional = Optional.ofNullable(name) - /** The currency code. */ - @JsonProperty("currency") fun currency(): String? = currency + /** The type of taxes. */ + @JsonProperty("type") fun type(): Optional = Optional.ofNullable(type) @JsonAnyGetter @ExcludeMissing @@ -1050,48 +1206,69 @@ constructor( 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 employer: Boolean? = null + private var name: String? = null + private var type: Type? = 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) + amount = tax.amount + currency = tax.currency + employer = tax.employer + name = tax.name + type = tax.type + additionalProperties = tax.additionalProperties.toMutableMap() } - /** 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 } + /** The tax amount in cents. */ + fun amount(amount: Long?) = apply { this.amount = amount } - /** `true` if the amount is paid by the employers. */ - @JsonProperty("employer") - fun employer(employer: Boolean) = apply { this.employer = employer } + /** The tax amount in cents. */ + fun amount(amount: Long) = amount(amount as Long?) /** The tax amount in cents. */ - @JsonProperty("amount") fun amount(amount: Long) = apply { this.amount = amount } + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun amount(amount: Optional) = amount(amount.orElse(null) as Long?) + + /** The currency code. */ + fun currency(currency: String?) = apply { this.currency = currency } /** The currency code. */ - @JsonProperty("currency") - fun currency(currency: String) = apply { this.currency = currency } + fun currency(currency: Optional) = currency(currency.orElse(null)) + + /** `true` if the amount is paid by the employers. */ + fun employer(employer: Boolean?) = apply { this.employer = employer } + + /** `true` if the amount is paid by the employers. */ + fun employer(employer: Boolean) = employer(employer as Boolean?) + + /** `true` if the amount is paid by the employers. */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun employer(employer: Optional) = + employer(employer.orElse(null) as Boolean?) + + /** The exact name of tax from the pay statement. */ + fun name(name: String?) = apply { this.name = name } + + /** The exact name of tax from the pay statement. */ + fun name(name: Optional) = name(name.orElse(null)) + + /** The type of taxes. */ + fun type(type: Type?) = apply { this.type = type } + + /** The type of taxes. */ + fun type(type: Optional) = type(type.orElse(null)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = @@ -1099,13 +1276,21 @@ constructor( this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Tax = Tax( - type, - name, - employer, amount, currency, + employer, + name, + type, additionalProperties.toImmutable(), ) } @@ -1184,17 +1369,17 @@ constructor( return true } - return /* spotless:off */ other is Tax && type == other.type && name == other.name && employer == other.employer && amount == other.amount && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tax && amount == other.amount && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, name, employer, amount, currency, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, currency, employer, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tax{type=$type, name=$name, employer=$employer, amount=$amount, currency=$currency, additionalProperties=$additionalProperties}" + "Tax{amount=$amount, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" } class Type @@ -1265,17 +1450,17 @@ constructor( return true } - return /* spotless:off */ other is PayStatement && individualId == other.individualId && type == other.type && paymentMethod == other.paymentMethod && totalHours == other.totalHours && grossPay == other.grossPay && netPay == other.netPay && earnings == other.earnings && taxes == other.taxes && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PayStatement && earnings == other.earnings && employeeDeductions == other.employeeDeductions && employerContributions == other.employerContributions && grossPay == other.grossPay && individualId == other.individualId && netPay == other.netPay && paymentMethod == other.paymentMethod && taxes == other.taxes && totalHours == other.totalHours && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, type, paymentMethod, totalHours, grossPay, netPay, earnings, taxes, employeeDeductions, employerContributions, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(earnings, employeeDeductions, employerContributions, grossPay, individualId, netPay, paymentMethod, taxes, totalHours, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = 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}" + "PayStatement{earnings=$earnings, employeeDeductions=$employeeDeductions, employerContributions=$employerContributions, grossPay=$grossPay, individualId=$individualId, netPay=$netPay, paymentMethod=$paymentMethod, taxes=$taxes, totalHours=$totalHours, type=$type, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1283,11 +1468,11 @@ constructor( return true } - return /* spotless:off */ other is SandboxPaymentCreateParams && endDate == other.endDate && payStatements == other.payStatements && startDate == other.startDate && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is SandboxPaymentCreateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(endDate, payStatements, startDate, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxPaymentCreateParams{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "SandboxPaymentCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt index 861f7dbc..d9f50133 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionNewResponse.kt @@ -4,47 +4,52 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = SessionNewResponse.Builder::class) @NoAutoDetect class SessionNewResponse +@JsonCreator private constructor( - private val sessionId: JsonField, - private val connectUrl: JsonField, - private val additionalProperties: Map, + @JsonProperty("connect_url") + @ExcludeMissing + private val connectUrl: JsonField = JsonMissing.of(), + @JsonProperty("session_id") + @ExcludeMissing + private val sessionId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The Connect URL to redirect the user to for authentication */ + fun connectUrl(): String = connectUrl.getRequired("connect_url") /** The unique identifier for the created connect session */ fun sessionId(): String = sessionId.getRequired("session_id") /** The Connect URL to redirect the user to for authentication */ - fun connectUrl(): String = connectUrl.getRequired("connect_url") + @JsonProperty("connect_url") @ExcludeMissing fun _connectUrl() = connectUrl /** The unique identifier for the created connect session */ @JsonProperty("session_id") @ExcludeMissing fun _sessionId() = sessionId - /** The Connect URL to redirect the user to for authentication */ - @JsonProperty("connect_url") @ExcludeMissing fun _connectUrl() = connectUrl - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SessionNewResponse = apply { if (!validated) { - sessionId() connectUrl() + sessionId() validated = true } } @@ -58,51 +63,52 @@ private constructor( class Builder { - private var sessionId: JsonField = JsonMissing.of() private var connectUrl: JsonField = JsonMissing.of() + private var sessionId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sessionNewResponse: SessionNewResponse) = apply { - this.sessionId = sessionNewResponse.sessionId - this.connectUrl = sessionNewResponse.connectUrl - additionalProperties(sessionNewResponse.additionalProperties) + connectUrl = sessionNewResponse.connectUrl + sessionId = sessionNewResponse.sessionId + additionalProperties = sessionNewResponse.additionalProperties.toMutableMap() } - /** The unique identifier for the created connect session */ - fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId)) - - /** The unique identifier for the created connect session */ - @JsonProperty("session_id") - @ExcludeMissing - fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId } - /** The Connect URL to redirect the user to for authentication */ fun connectUrl(connectUrl: String) = connectUrl(JsonField.of(connectUrl)) /** The Connect URL to redirect the user to for authentication */ - @JsonProperty("connect_url") - @ExcludeMissing fun connectUrl(connectUrl: JsonField) = apply { this.connectUrl = connectUrl } + /** The unique identifier for the created connect session */ + fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId)) + + /** The unique identifier for the created connect session */ + fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SessionNewResponse = SessionNewResponse( - sessionId, connectUrl, + sessionId, additionalProperties.toImmutable(), ) } @@ -112,15 +118,15 @@ private constructor( return true } - return /* spotless:off */ other is SessionNewResponse && sessionId == other.sessionId && connectUrl == other.connectUrl && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SessionNewResponse && connectUrl == other.connectUrl && sessionId == other.sessionId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(sessionId, connectUrl, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(connectUrl, sessionId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SessionNewResponse{sessionId=$sessionId, connectUrl=$connectUrl, additionalProperties=$additionalProperties}" + "SessionNewResponse{connectUrl=$connectUrl, sessionId=$sessionId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt index b6d8d15e..5cbb526d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SessionReauthenticateResponse.kt @@ -4,47 +4,52 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = SessionReauthenticateResponse.Builder::class) @NoAutoDetect class SessionReauthenticateResponse +@JsonCreator private constructor( - private val sessionId: JsonField, - private val connectUrl: JsonField, - private val additionalProperties: Map, + @JsonProperty("connect_url") + @ExcludeMissing + private val connectUrl: JsonField = JsonMissing.of(), + @JsonProperty("session_id") + @ExcludeMissing + private val sessionId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false + /** The Connect URL to redirect the user to for reauthentication */ + fun connectUrl(): String = connectUrl.getRequired("connect_url") /** The unique identifier for the created connect session */ fun sessionId(): String = sessionId.getRequired("session_id") /** The Connect URL to redirect the user to for reauthentication */ - fun connectUrl(): String = connectUrl.getRequired("connect_url") + @JsonProperty("connect_url") @ExcludeMissing fun _connectUrl() = connectUrl /** The unique identifier for the created connect session */ @JsonProperty("session_id") @ExcludeMissing fun _sessionId() = sessionId - /** The Connect URL to redirect the user to for reauthentication */ - @JsonProperty("connect_url") @ExcludeMissing fun _connectUrl() = connectUrl - @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SessionReauthenticateResponse = apply { if (!validated) { - sessionId() connectUrl() + sessionId() validated = true } } @@ -58,51 +63,52 @@ private constructor( class Builder { - private var sessionId: JsonField = JsonMissing.of() private var connectUrl: JsonField = JsonMissing.of() + private var sessionId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(sessionReauthenticateResponse: SessionReauthenticateResponse) = apply { - this.sessionId = sessionReauthenticateResponse.sessionId - this.connectUrl = sessionReauthenticateResponse.connectUrl - additionalProperties(sessionReauthenticateResponse.additionalProperties) + connectUrl = sessionReauthenticateResponse.connectUrl + sessionId = sessionReauthenticateResponse.sessionId + additionalProperties = sessionReauthenticateResponse.additionalProperties.toMutableMap() } - /** The unique identifier for the created connect session */ - fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId)) - - /** The unique identifier for the created connect session */ - @JsonProperty("session_id") - @ExcludeMissing - fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId } - /** The Connect URL to redirect the user to for reauthentication */ fun connectUrl(connectUrl: String) = connectUrl(JsonField.of(connectUrl)) /** The Connect URL to redirect the user to for reauthentication */ - @JsonProperty("connect_url") - @ExcludeMissing fun connectUrl(connectUrl: JsonField) = apply { this.connectUrl = connectUrl } + /** The unique identifier for the created connect session */ + fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId)) + + /** The unique identifier for the created connect session */ + fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SessionReauthenticateResponse = SessionReauthenticateResponse( - sessionId, connectUrl, + sessionId, additionalProperties.toImmutable(), ) } @@ -112,15 +118,15 @@ private constructor( return true } - return /* spotless:off */ other is SessionReauthenticateResponse && sessionId == other.sessionId && connectUrl == other.connectUrl && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SessionReauthenticateResponse && connectUrl == other.connectUrl && sessionId == other.sessionId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(sessionId, connectUrl, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(connectUrl, sessionId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SessionReauthenticateResponse{sessionId=$sessionId, connectUrl=$connectUrl, additionalProperties=$additionalProperties}" + "SessionReauthenticateResponse{connectUrl=$connectUrl, sessionId=$sessionId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt index 9cdada36..7cb4d5fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportPerBenefitType.kt @@ -4,28 +4,31 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = SupportPerBenefitType.Builder::class) @NoAutoDetect class SupportPerBenefitType +@JsonCreator private constructor( - private val companyBenefits: JsonField, - private val individualBenefits: JsonField, - private val additionalProperties: Map, + @JsonProperty("company_benefits") + @ExcludeMissing + private val companyBenefits: JsonField = JsonMissing.of(), + @JsonProperty("individual_benefits") + @ExcludeMissing + private val individualBenefits: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun companyBenefits(): Optional = Optional.ofNullable(companyBenefits.getNullable("company_benefits")) @@ -42,6 +45,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportPerBenefitType = apply { if (!validated) { companyBenefits().map { it.validate() } @@ -65,16 +70,14 @@ private constructor( @JvmSynthetic internal fun from(supportPerBenefitType: SupportPerBenefitType) = apply { - this.companyBenefits = supportPerBenefitType.companyBenefits - this.individualBenefits = supportPerBenefitType.individualBenefits - additionalProperties(supportPerBenefitType.additionalProperties) + companyBenefits = supportPerBenefitType.companyBenefits + individualBenefits = supportPerBenefitType.individualBenefits + additionalProperties = supportPerBenefitType.additionalProperties.toMutableMap() } fun companyBenefits(companyBenefits: OperationSupportMatrix) = companyBenefits(JsonField.of(companyBenefits)) - @JsonProperty("company_benefits") - @ExcludeMissing fun companyBenefits(companyBenefits: JsonField) = apply { this.companyBenefits = companyBenefits } @@ -82,26 +85,29 @@ private constructor( fun individualBenefits(individualBenefits: OperationSupportMatrix) = individualBenefits(JsonField.of(individualBenefits)) - @JsonProperty("individual_benefits") - @ExcludeMissing fun individualBenefits(individualBenefits: JsonField) = apply { this.individualBenefits = individualBenefits } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportPerBenefitType = SupportPerBenefitType( companyBenefits, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index 670fdc1e..8fba0666 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -6,53 +6,49 @@ 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.Enum import com.tryfinch.api.core.ExcludeMissing import com.tryfinch.api.core.JsonField import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.immutableEmptyMap import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = SupportedBenefit.Builder::class) @NoAutoDetect class SupportedBenefit +@JsonCreator private constructor( - private val type: JsonField, - private val description: JsonField, - private val frequencies: JsonField>, - private val employeeDeduction: JsonField>, - private val companyContribution: JsonField>, - private val annualMaximum: JsonField, - private val catchUp: JsonField, - private val hsaContributionLimit: JsonField>, - private val additionalProperties: Map, + @JsonProperty("annual_maximum") + @ExcludeMissing + private val annualMaximum: JsonField = JsonMissing.of(), + @JsonProperty("catch_up") + @ExcludeMissing + private val catchUp: JsonField = JsonMissing.of(), + @JsonProperty("company_contribution") + @ExcludeMissing + private val companyContribution: JsonField> = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + private val description: JsonField = JsonMissing.of(), + @JsonProperty("employee_deduction") + @ExcludeMissing + private val employeeDeduction: JsonField> = JsonMissing.of(), + @JsonProperty("frequencies") + @ExcludeMissing + private val frequencies: JsonField> = JsonMissing.of(), + @JsonProperty("hsa_contribution_limit") + @ExcludeMissing + private val hsaContributionLimit: JsonField> = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Type of benefit. */ - fun type(): Optional = Optional.ofNullable(type.getNullable("type")) - - fun description(): Optional = - Optional.ofNullable(description.getNullable("description")) - - /** The list of frequencies supported by the provider for this benefit */ - fun frequencies(): Optional> = - Optional.ofNullable(frequencies.getNullable("frequencies")) - - /** Supported deduction types. An empty array indicates deductions are not supported. */ - fun employeeDeduction(): Optional> = - Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) - - /** Supported contribution types. An empty array indicates contributions are not supported. */ - fun companyContribution(): Optional> = - Optional.ofNullable(companyContribution.getNullable("company_contribution")) - /** Whether the provider supports an annual maximum for this benefit. */ fun annualMaximum(): Optional = Optional.ofNullable(annualMaximum.getNullable("annual_maximum")) @@ -63,6 +59,21 @@ private constructor( */ fun catchUp(): Optional = Optional.ofNullable(catchUp.getNullable("catch_up")) + /** Supported contribution types. An empty array indicates contributions are not supported. */ + fun companyContribution(): Optional> = + Optional.ofNullable(companyContribution.getNullable("company_contribution")) + + fun description(): Optional = + Optional.ofNullable(description.getNullable("description")) + + /** Supported deduction types. An empty array indicates deductions are not supported. */ + fun employeeDeduction(): Optional> = + Optional.ofNullable(employeeDeduction.getNullable("employee_deduction")) + + /** The list of frequencies supported by the provider for this benefit */ + fun frequencies(): Optional> = + Optional.ofNullable(frequencies.getNullable("frequencies")) + /** * Whether the provider supports HSA contribution limits. Empty if this feature is not supported * for the benefit. This array only has values for HSA benefits. @@ -71,20 +82,7 @@ private constructor( Optional.ofNullable(hsaContributionLimit.getNullable("hsa_contribution_limit")) /** Type of benefit. */ - @JsonProperty("type") @ExcludeMissing fun _type() = type - - @JsonProperty("description") @ExcludeMissing fun _description() = description - - /** The list of frequencies supported by the provider for this benefit */ - @JsonProperty("frequencies") @ExcludeMissing fun _frequencies() = frequencies - - /** Supported deduction types. An empty array indicates deductions are not supported. */ - @JsonProperty("employee_deduction") @ExcludeMissing fun _employeeDeduction() = employeeDeduction - - /** Supported contribution types. An empty array indicates contributions are not supported. */ - @JsonProperty("company_contribution") - @ExcludeMissing - fun _companyContribution() = companyContribution + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) /** Whether the provider supports an annual maximum for this benefit. */ @JsonProperty("annual_maximum") @ExcludeMissing fun _annualMaximum() = annualMaximum @@ -95,6 +93,19 @@ private constructor( */ @JsonProperty("catch_up") @ExcludeMissing fun _catchUp() = catchUp + /** Supported contribution types. An empty array indicates contributions are not supported. */ + @JsonProperty("company_contribution") + @ExcludeMissing + fun _companyContribution() = companyContribution + + @JsonProperty("description") @ExcludeMissing fun _description() = description + + /** Supported deduction types. An empty array indicates deductions are not supported. */ + @JsonProperty("employee_deduction") @ExcludeMissing fun _employeeDeduction() = employeeDeduction + + /** The list of frequencies supported by the provider for this benefit */ + @JsonProperty("frequencies") @ExcludeMissing fun _frequencies() = frequencies + /** * Whether the provider supports HSA contribution limits. Empty if this feature is not supported * for the benefit. This array only has values for HSA benefits. @@ -103,20 +114,25 @@ private constructor( @ExcludeMissing fun _hsaContributionLimit() = hsaContributionLimit + /** Type of benefit. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): SupportedBenefit = apply { if (!validated) { - type() - description() - frequencies() - employeeDeduction() - companyContribution() annualMaximum() catchUp() + companyContribution() + description() + employeeDeduction() + frequencies() hsaContributionLimit() + type() validated = true } } @@ -130,64 +146,48 @@ private constructor( class Builder { - private var type: JsonField = JsonMissing.of() - private var description: JsonField = JsonMissing.of() - private var frequencies: JsonField> = JsonMissing.of() - private var employeeDeduction: JsonField> = JsonMissing.of() - private var companyContribution: JsonField> = JsonMissing.of() private var annualMaximum: JsonField = JsonMissing.of() private var catchUp: JsonField = JsonMissing.of() + private var companyContribution: JsonField> = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var employeeDeduction: JsonField> = JsonMissing.of() + private var frequencies: JsonField> = JsonMissing.of() private var hsaContributionLimit: JsonField> = JsonMissing.of() + private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(supportedBenefit: SupportedBenefit) = apply { - this.type = supportedBenefit.type - this.description = supportedBenefit.description - this.frequencies = supportedBenefit.frequencies - this.employeeDeduction = supportedBenefit.employeeDeduction - this.companyContribution = supportedBenefit.companyContribution - this.annualMaximum = supportedBenefit.annualMaximum - this.catchUp = supportedBenefit.catchUp - this.hsaContributionLimit = supportedBenefit.hsaContributionLimit - additionalProperties(supportedBenefit.additionalProperties) + annualMaximum = supportedBenefit.annualMaximum + catchUp = supportedBenefit.catchUp + companyContribution = supportedBenefit.companyContribution + description = supportedBenefit.description + employeeDeduction = supportedBenefit.employeeDeduction + frequencies = supportedBenefit.frequencies + hsaContributionLimit = supportedBenefit.hsaContributionLimit + type = supportedBenefit.type + additionalProperties = supportedBenefit.additionalProperties.toMutableMap() } - /** Type of benefit. */ - fun type(type: BenefitType) = type(JsonField.of(type)) - - /** Type of benefit. */ - @JsonProperty("type") - @ExcludeMissing - fun type(type: JsonField) = apply { this.type = type } - - fun description(description: String) = description(JsonField.of(description)) - - @JsonProperty("description") - @ExcludeMissing - fun description(description: JsonField) = apply { this.description = description } - - /** The list of frequencies supported by the provider for this benefit */ - fun frequencies(frequencies: List) = - frequencies(JsonField.of(frequencies)) + /** Whether the provider supports an annual maximum for this benefit. */ + fun annualMaximum(annualMaximum: Boolean) = annualMaximum(JsonField.of(annualMaximum)) - /** The list of frequencies supported by the provider for this benefit */ - @JsonProperty("frequencies") - @ExcludeMissing - fun frequencies(frequencies: JsonField>) = apply { - this.frequencies = frequencies + /** Whether the provider supports an annual maximum for this benefit. */ + fun annualMaximum(annualMaximum: JsonField) = apply { + this.annualMaximum = annualMaximum } - /** Supported deduction types. An empty array indicates deductions are not supported. */ - fun employeeDeduction(employeeDeduction: List) = - employeeDeduction(JsonField.of(employeeDeduction)) + /** + * Whether the provider supports catch up for this benefit. This field will only be true for + * retirement benefits. + */ + fun catchUp(catchUp: Boolean) = catchUp(JsonField.of(catchUp)) - /** Supported deduction types. An empty array indicates deductions are not supported. */ - @JsonProperty("employee_deduction") - @ExcludeMissing - fun employeeDeduction(employeeDeduction: JsonField>) = apply { - this.employeeDeduction = employeeDeduction - } + /** + * Whether the provider supports catch up for this benefit. This field will only be true for + * retirement benefits. + */ + fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp } /** * Supported contribution types. An empty array indicates contributions are not supported. @@ -198,36 +198,32 @@ private constructor( /** * Supported contribution types. An empty array indicates contributions are not supported. */ - @JsonProperty("company_contribution") - @ExcludeMissing fun companyContribution(companyContribution: JsonField>) = apply { this.companyContribution = companyContribution } - /** Whether the provider supports an annual maximum for this benefit. */ - fun annualMaximum(annualMaximum: Boolean) = annualMaximum(JsonField.of(annualMaximum)) + fun description(description: String) = description(JsonField.of(description)) - /** Whether the provider supports an annual maximum for this benefit. */ - @JsonProperty("annual_maximum") - @ExcludeMissing - fun annualMaximum(annualMaximum: JsonField) = apply { - this.annualMaximum = annualMaximum + fun description(description: JsonField) = apply { this.description = description } + + /** Supported deduction types. An empty array indicates deductions are not supported. */ + fun employeeDeduction(employeeDeduction: List) = + employeeDeduction(JsonField.of(employeeDeduction)) + + /** Supported deduction types. An empty array indicates deductions are not supported. */ + fun employeeDeduction(employeeDeduction: JsonField>) = apply { + this.employeeDeduction = employeeDeduction } - /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. - */ - fun catchUp(catchUp: Boolean) = catchUp(JsonField.of(catchUp)) + /** The list of frequencies supported by the provider for this benefit */ + fun frequencies(frequencies: List) = + frequencies(JsonField.of(frequencies)) - /** - * Whether the provider supports catch up for this benefit. This field will only be true for - * retirement benefits. - */ - @JsonProperty("catch_up") - @ExcludeMissing - fun catchUp(catchUp: JsonField) = apply { this.catchUp = catchUp } + /** The list of frequencies supported by the provider for this benefit */ + fun frequencies(frequencies: JsonField>) = apply { + this.frequencies = frequencies + } /** * Whether the provider supports HSA contribution limits. Empty if this feature is not @@ -240,37 +236,46 @@ private constructor( * Whether the provider supports HSA contribution limits. Empty if this feature is not * supported for the benefit. This array only has values for HSA benefits. */ - @JsonProperty("hsa_contribution_limit") - @ExcludeMissing fun hsaContributionLimit(hsaContributionLimit: JsonField>) = apply { this.hsaContributionLimit = hsaContributionLimit } + /** Type of benefit. */ + fun type(type: BenefitType) = type(JsonField.of(type)) + + /** Type of benefit. */ + fun type(type: JsonField) = apply { this.type = type } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): SupportedBenefit = SupportedBenefit( - type, - description, - frequencies.map { it.toImmutable() }, - employeeDeduction.map { it.toImmutable() }, - companyContribution.map { it.toImmutable() }, annualMaximum, catchUp, + companyContribution.map { it.toImmutable() }, + description, + employeeDeduction.map { it.toImmutable() }, + frequencies.map { it.toImmutable() }, hsaContributionLimit.map { it.toImmutable() }, + type, additionalProperties.toImmutable(), ) } @@ -451,15 +456,15 @@ private constructor( return true } - return /* spotless:off */ other is SupportedBenefit && type == other.type && description == other.description && frequencies == other.frequencies && employeeDeduction == other.employeeDeduction && companyContribution == other.companyContribution && annualMaximum == other.annualMaximum && catchUp == other.catchUp && hsaContributionLimit == other.hsaContributionLimit && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is SupportedBenefit && annualMaximum == other.annualMaximum && catchUp == other.catchUp && companyContribution == other.companyContribution && description == other.description && employeeDeduction == other.employeeDeduction && frequencies == other.frequencies && hsaContributionLimit == other.hsaContributionLimit && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, description, frequencies, employeeDeduction, companyContribution, annualMaximum, catchUp, hsaContributionLimit, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(annualMaximum, catchUp, companyContribution, description, employeeDeduction, frequencies, hsaContributionLimit, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "SupportedBenefit{type=$type, description=$description, frequencies=$frequencies, employeeDeduction=$employeeDeduction, companyContribution=$companyContribution, annualMaximum=$annualMaximum, catchUp=$catchUp, hsaContributionLimit=$hsaContributionLimit, additionalProperties=$additionalProperties}" + "SupportedBenefit{annualMaximum=$annualMaximum, catchUp=$catchUp, companyContribution=$companyContribution, description=$description, employeeDeduction=$employeeDeduction, frequencies=$frequencies, hsaContributionLimit=$hsaContributionLimit, type=$type, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index 31cd41c2..d381cf19 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -4,53 +4,56 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = UnenrolledIndividual.Builder::class) @NoAutoDetect class UnenrolledIndividual +@JsonCreator private constructor( - private val individualId: JsonField, - private val code: JsonField, - private val body: JsonField, - private val additionalProperties: Map, + @JsonProperty("body") @ExcludeMissing private val body: JsonField = JsonMissing.of(), + @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - fun individualId(): Optional = - Optional.ofNullable(individualId.getNullable("individual_id")) + fun body(): Optional = Optional.ofNullable(body.getNullable("body")) /** HTTP status code */ fun code(): Optional = Optional.ofNullable(code.getNullable("code")) - fun body(): Optional = Optional.ofNullable(body.getNullable("body")) + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) - @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + @JsonProperty("body") @ExcludeMissing fun _body() = body /** HTTP status code */ @JsonProperty("code") @ExcludeMissing fun _code() = code - @JsonProperty("body") @ExcludeMissing fun _body() = body + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): UnenrolledIndividual = apply { if (!validated) { - individualId() - code() body().map { it.validate() } + code() + individualId() validated = true } } @@ -64,79 +67,80 @@ private constructor( class Builder { - private var individualId: JsonField = JsonMissing.of() - private var code: JsonField = JsonMissing.of() private var body: JsonField = JsonMissing.of() + private var code: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(unenrolledIndividual: UnenrolledIndividual) = apply { - this.individualId = unenrolledIndividual.individualId - this.code = unenrolledIndividual.code - this.body = unenrolledIndividual.body - additionalProperties(unenrolledIndividual.additionalProperties) + body = unenrolledIndividual.body + code = unenrolledIndividual.code + individualId = unenrolledIndividual.individualId + additionalProperties = unenrolledIndividual.additionalProperties.toMutableMap() } - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + fun body(body: Body) = body(JsonField.of(body)) - @JsonProperty("individual_id") - @ExcludeMissing - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId - } + fun body(body: JsonField) = apply { this.body = body } /** HTTP status code */ fun code(code: Long) = code(JsonField.of(code)) /** HTTP status code */ - @JsonProperty("code") - @ExcludeMissing fun code(code: JsonField) = apply { this.code = code } - fun body(body: Body) = body(JsonField.of(body)) + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) - @JsonProperty("body") - @ExcludeMissing - fun body(body: JsonField) = apply { this.body = body } + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): UnenrolledIndividual = UnenrolledIndividual( - individualId, - code, body, + code, + individualId, additionalProperties.toImmutable(), ) } - @JsonDeserialize(builder = Body.Builder::class) @NoAutoDetect class Body + @JsonCreator private constructor( - private val name: JsonField, - private val finchCode: JsonField, - private val message: JsonField, - private val additionalProperties: Map, + @JsonProperty("finch_code") + @ExcludeMissing + private val finchCode: JsonField = JsonMissing.of(), + @JsonProperty("message") + @ExcludeMissing + private val message: JsonField = JsonMissing.of(), + @JsonProperty("name") + @ExcludeMissing + private val name: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - - /** Identifier indicating whether the benefit was newly enrolled or updated. */ - fun name(): Optional = Optional.ofNullable(name.getNullable("name")) - /** A descriptive identifier for the response. */ fun finchCode(): Optional = Optional.ofNullable(finchCode.getNullable("finch_code")) @@ -144,7 +148,7 @@ private constructor( fun message(): Optional = Optional.ofNullable(message.getNullable("message")) /** Identifier indicating whether the benefit was newly enrolled or updated. */ - @JsonProperty("name") @ExcludeMissing fun _name() = name + fun name(): Optional = Optional.ofNullable(name.getNullable("name")) /** A descriptive identifier for the response. */ @JsonProperty("finch_code") @ExcludeMissing fun _finchCode() = finchCode @@ -152,15 +156,20 @@ private constructor( /** Short description in English that provides more information about the response. */ @JsonProperty("message") @ExcludeMissing fun _message() = message + /** Identifier indicating whether the benefit was newly enrolled or updated. */ + @JsonProperty("name") @ExcludeMissing fun _name() = name + @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): Body = apply { if (!validated) { - name() finchCode() message() + name() validated = true } } @@ -174,62 +183,61 @@ private constructor( class Builder { - private var name: JsonField = JsonMissing.of() private var finchCode: JsonField = JsonMissing.of() private var message: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { - this.name = body.name - this.finchCode = body.finchCode - this.message = body.message - additionalProperties(body.additionalProperties) + finchCode = body.finchCode + message = body.message + name = body.name + additionalProperties = body.additionalProperties.toMutableMap() } - /** Identifier indicating whether the benefit was newly enrolled or updated. */ - fun name(name: String) = name(JsonField.of(name)) - - /** Identifier indicating whether the benefit was newly enrolled or updated. */ - @JsonProperty("name") - @ExcludeMissing - fun name(name: JsonField) = apply { this.name = name } - /** A descriptive identifier for the response. */ fun finchCode(finchCode: String) = finchCode(JsonField.of(finchCode)) /** A descriptive identifier for the response. */ - @JsonProperty("finch_code") - @ExcludeMissing fun finchCode(finchCode: JsonField) = apply { this.finchCode = finchCode } /** Short description in English that provides more information about the response. */ fun message(message: String) = message(JsonField.of(message)) /** Short description in English that provides more information about the response. */ - @JsonProperty("message") - @ExcludeMissing fun message(message: JsonField) = apply { this.message = message } + /** Identifier indicating whether the benefit was newly enrolled or updated. */ + fun name(name: String) = name(JsonField.of(name)) + + /** Identifier indicating whether the benefit was newly enrolled or updated. */ + fun name(name: JsonField) = apply { this.name = name } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): Body = Body( - name, finchCode, message, + name, additionalProperties.toImmutable(), ) } @@ -239,17 +247,17 @@ private constructor( return true } - return /* spotless:off */ other is Body && name == other.name && finchCode == other.finchCode && message == other.message && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && finchCode == other.finchCode && message == other.message && name == other.name && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, finchCode, message, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(finchCode, message, name, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{name=$name, finchCode=$finchCode, message=$message, additionalProperties=$additionalProperties}" + "Body{finchCode=$finchCode, message=$message, name=$name, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -257,15 +265,15 @@ private constructor( return true } - return /* spotless:off */ other is UnenrolledIndividual && individualId == other.individualId && code == other.code && body == other.body && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is UnenrolledIndividual && body == other.body && code == other.code && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, code, body, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(body, code, individualId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "UnenrolledIndividual{individualId=$individualId, code=$code, body=$body, additionalProperties=$additionalProperties}" + "UnenrolledIndividual{body=$body, code=$code, individualId=$individualId, additionalProperties=$additionalProperties}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index e28516c4..c039218a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -4,26 +4,27 @@ 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.immutableEmptyMap import com.tryfinch.api.core.toImmutable import java.util.Objects -@JsonDeserialize(builder = UpdateCompanyBenefitResponse.Builder::class) @NoAutoDetect class UpdateCompanyBenefitResponse +@JsonCreator private constructor( - private val benefitId: JsonField, - private val additionalProperties: Map, + @JsonProperty("benefit_id") + @ExcludeMissing + private val benefitId: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), ) { - private var validated: Boolean = false - fun benefitId(): String = benefitId.getRequired("benefit_id") @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId() = benefitId @@ -32,6 +33,8 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties + private var validated: Boolean = false + fun validate(): UpdateCompanyBenefitResponse = apply { if (!validated) { benefitId() @@ -53,30 +56,33 @@ private constructor( @JvmSynthetic internal fun from(updateCompanyBenefitResponse: UpdateCompanyBenefitResponse) = apply { - this.benefitId = updateCompanyBenefitResponse.benefitId - additionalProperties(updateCompanyBenefitResponse.additionalProperties) + benefitId = updateCompanyBenefitResponse.benefitId + additionalProperties = updateCompanyBenefitResponse.additionalProperties.toMutableMap() } fun benefitId(benefitId: String) = benefitId(JsonField.of(benefitId)) - @JsonProperty("benefit_id") - @ExcludeMissing fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() - this.additionalProperties.putAll(additionalProperties) + putAllAdditionalProperties(additionalProperties) } - @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { - this.additionalProperties.put(key, value) + additionalProperties.put(key, value) } fun putAllAdditionalProperties(additionalProperties: Map) = apply { this.additionalProperties.putAll(additionalProperties) } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + fun build(): UpdateCompanyBenefitResponse = UpdateCompanyBenefitResponse(benefitId, additionalProperties.toImmutable()) } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt index a853a057..e4779e68 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt @@ -29,9 +29,9 @@ class AccessTokenCreateParamsTest { val body = params.getBody() assertThat(body).isNotNull assertThat(body.code()).isEqualTo("") - assertThat(body.clientId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(body.clientSecret()).isEqualTo("") - assertThat(body.redirectUri()).isEqualTo("https://example.com") + assertThat(body.clientId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.clientSecret()).contains("") + assertThat(body.redirectUri()).contains("https://example.com") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt index 5ab13be5..0710ca50 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt @@ -52,18 +52,18 @@ class ConnectSessionNewParamsTest { assertThat(body.customerName()).isEqualTo("x") assertThat(body.products()) .isEqualTo(listOf(ConnectSessionNewParams.ConnectProducts.COMPANY)) - assertThat(body.customerEmail()).isEqualTo("dev@stainlessapi.com") + assertThat(body.customerEmail()).contains("dev@stainlessapi.com") assertThat(body.integration()) - .isEqualTo( + .contains( ConnectSessionNewParams.Integration.builder() .authMethod(ConnectSessionNewParams.Integration.AuthMethod.ASSISTED) .provider("provider") .build() ) - assertThat(body.manual()).isEqualTo(true) - assertThat(body.minutesToExpire()).isEqualTo(1.0) - assertThat(body.redirectUri()).isEqualTo("redirect_uri") - assertThat(body.sandbox()).isEqualTo(ConnectSessionNewParams.Sandbox.FINCH) + assertThat(body.manual()).contains(true) + assertThat(body.minutesToExpire()).contains(1.0) + assertThat(body.redirectUri()).contains("redirect_uri") + assertThat(body.sandbox()).contains(ConnectSessionNewParams.Sandbox.FINCH) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt index 6e091f6c..8bcdce50 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt @@ -29,10 +29,10 @@ class ConnectSessionReauthenticateParamsTest { val body = params.getBody() assertThat(body).isNotNull assertThat(body.connectionId()).isEqualTo("connection_id") - assertThat(body.minutesToExpire()).isEqualTo(0L) + assertThat(body.minutesToExpire()).contains(0L) assertThat(body.products()) - .isEqualTo(listOf(ConnectSessionReauthenticateParams.ConnectProducts.COMPANY)) - assertThat(body.redirectUri()).isEqualTo("https://example.com") + .contains(listOf(ConnectSessionReauthenticateParams.ConnectProducts.COMPANY)) + assertThat(body.redirectUri()).contains("https://example.com") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt index 0e43ccd7..342c46e5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt @@ -26,9 +26,9 @@ class HrisBenefitCreateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.description()).isEqualTo("description") - assertThat(body.frequency()).isEqualTo(BenefitFrequency.ONE_TIME) - assertThat(body.type()).isEqualTo(BenefitType._401K) + assertThat(body.description()).contains("description") + assertThat(body.frequency()).contains(BenefitFrequency.ONE_TIME) + assertThat(body.type()).contains(BenefitType._401K) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt index 31c8d60c..74ebc36e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt @@ -24,7 +24,7 @@ class HrisBenefitIndividualUnenrollManyParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.individualIds()).isEqualTo(listOf("string")) + assertThat(body.individualIds()).contains(listOf("string")) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt index 7d964aac..cc9b6ab7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt @@ -21,7 +21,7 @@ class HrisBenefitUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.description()).isEqualTo("description") + assertThat(body.description()).contains("description") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt index b6c3d852..6cb7fdac 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt @@ -43,11 +43,11 @@ class HrisIndividualRetrieveManyParamsTest { val body = params.getBody() assertThat(body).isNotNull assertThat(body.options()) - .isEqualTo( + .contains( HrisIndividualRetrieveManyParams.Options.builder().include(listOf("string")).build() ) assertThat(body.requests()) - .isEqualTo( + .contains( listOf( HrisIndividualRetrieveManyParams.Request.builder() .individualId("individual_id") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt index ca20418f..9c384e5e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt @@ -32,9 +32,9 @@ class RequestForwardingForwardParamsTest { assertThat(body.method()).isEqualTo("POST") assertThat(body.route()).isEqualTo("/people/search") assertThat(body.headers()) - .isEqualTo(JsonValue.from(mapOf("content-type" to "application/json"))) + .contains(JsonValue.from(mapOf("content-type" to "application/json"))) assertThat(body.params()) - .isEqualTo(JsonValue.from(mapOf("showInactive" to true, "humanReadable" to true))) + .contains(JsonValue.from(mapOf("showInactive" to true, "humanReadable" to true))) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt index 31a66c38..78f95dbe 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -115,7 +115,7 @@ class SandboxCompanyUpdateParamsTest { val body = params.getBody() assertThat(body).isNotNull assertThat(body.accounts()) - .isEqualTo( + .contains( listOf( SandboxCompanyUpdateParams.Account.builder() .accountName("account_name") @@ -127,7 +127,7 @@ class SandboxCompanyUpdateParamsTest { ) ) assertThat(body.departments()) - .isEqualTo( + .contains( listOf( SandboxCompanyUpdateParams.Department.builder() .name("name") @@ -139,17 +139,17 @@ class SandboxCompanyUpdateParamsTest { .build() ) ) - assertThat(body.ein()).isEqualTo("ein") + assertThat(body.ein()).contains("ein") assertThat(body.entity()) - .isEqualTo( + .contains( SandboxCompanyUpdateParams.Entity.builder() .subtype(SandboxCompanyUpdateParams.Entity.Subtype.S_CORPORATION) .type(SandboxCompanyUpdateParams.Entity.Type.LLC) .build() ) - assertThat(body.legalName()).isEqualTo("legal_name") + assertThat(body.legalName()).contains("legal_name") assertThat(body.locations()) - .isEqualTo( + .contains( listOf( Location.builder() .city("city") @@ -163,8 +163,8 @@ class SandboxCompanyUpdateParamsTest { .build() ) ) - assertThat(body.primaryEmail()).isEqualTo("primary_email") - assertThat(body.primaryPhoneNumber()).isEqualTo("primary_phone_number") + assertThat(body.primaryEmail()).contains("primary_email") + assertThat(body.primaryPhoneNumber()).contains("primary_phone_number") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt index baae8277..e3edeb1f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt @@ -33,8 +33,8 @@ class SandboxConnectionAccountCreateParamsTest { assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) - .isEqualTo(SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIAL) - assertThat(body.products()).isEqualTo(listOf("string")) + .contains(SandboxConnectionAccountCreateParams.AuthenticationType.CREDENTIAL) + assertThat(body.products()).contains(listOf("string")) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt index a152cf9e..1e5682f5 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt @@ -22,7 +22,7 @@ class SandboxConnectionAccountUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.connectionStatus()).isEqualTo(ConnectionStatusType.PENDING) + assertThat(body.connectionStatus()).contains(ConnectionStatusType.PENDING) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt index 074f1205..b1ab1137 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt @@ -30,9 +30,9 @@ class SandboxConnectionCreateParamsTest { assertThat(body).isNotNull assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) - .isEqualTo(SandboxConnectionCreateParams.AuthenticationType.CREDENTIAL) - assertThat(body.employeeSize()).isEqualTo(0L) - assertThat(body.products()).isEqualTo(listOf("string")) + .contains(SandboxConnectionCreateParams.AuthenticationType.CREDENTIAL) + assertThat(body.employeeSize()).contains(0L) + assertThat(body.products()).contains(listOf("string")) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt index ba6698c7..92630138 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -137,9 +137,9 @@ class SandboxEmploymentUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.classCode()).isEqualTo("class_code") + assertThat(body.classCode()).contains("class_code") assertThat(body.customFields()) - .isEqualTo( + .contains( listOf( SandboxEmploymentUpdateParams.CustomField.builder() .name("name") @@ -148,20 +148,20 @@ class SandboxEmploymentUpdateParamsTest { ) ) assertThat(body.department()) - .isEqualTo(SandboxEmploymentUpdateParams.Department.builder().name("name").build()) + .contains(SandboxEmploymentUpdateParams.Department.builder().name("name").build()) assertThat(body.employment()) - .isEqualTo( + .contains( SandboxEmploymentUpdateParams.Employment.builder() .subtype(SandboxEmploymentUpdateParams.Employment.Subtype.FULL_TIME) .type(SandboxEmploymentUpdateParams.Employment.Type.EMPLOYEE) .build() ) assertThat(body.employmentStatus()) - .isEqualTo(SandboxEmploymentUpdateParams.EmploymentStatus.ACTIVE) - assertThat(body.endDate()).isEqualTo("end_date") - assertThat(body.firstName()).isEqualTo("first_name") + .contains(SandboxEmploymentUpdateParams.EmploymentStatus.ACTIVE) + assertThat(body.endDate()).contains("end_date") + assertThat(body.firstName()).contains("first_name") assertThat(body.income()) - .isEqualTo( + .contains( Income.builder() .amount(0L) .currency("currency") @@ -170,7 +170,7 @@ class SandboxEmploymentUpdateParamsTest { .build() ) assertThat(body.incomeHistory()) - .isEqualTo( + .contains( listOf( Income.builder() .amount(0L) @@ -180,11 +180,11 @@ class SandboxEmploymentUpdateParamsTest { .build() ) ) - assertThat(body.isActive()).isEqualTo(true) - assertThat(body.lastName()).isEqualTo("last_name") - assertThat(body.latestRehireDate()).isEqualTo("latest_rehire_date") + assertThat(body.isActive()).contains(true) + assertThat(body.lastName()).contains("last_name") + assertThat(body.latestRehireDate()).contains("latest_rehire_date") assertThat(body.location()) - .isEqualTo( + .contains( Location.builder() .city("city") .country("country") @@ -197,11 +197,11 @@ class SandboxEmploymentUpdateParamsTest { .build() ) assertThat(body.manager()) - .isEqualTo(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) - assertThat(body.middleName()).isEqualTo("middle_name") - assertThat(body.sourceId()).isEqualTo("source_id") - assertThat(body.startDate()).isEqualTo("3/4/2020") - assertThat(body.title()).isEqualTo("title") + .contains(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) + assertThat(body.middleName()).contains("middle_name") + assertThat(body.sourceId()).contains("source_id") + assertThat(body.startDate()).contains("3/4/2020") + assertThat(body.title()).contains("title") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt index 35fa8848..464cec4e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt @@ -96,9 +96,9 @@ class SandboxIndividualUpdateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.dob()).isEqualTo("12/20/1989") + assertThat(body.dob()).contains("12/20/1989") assertThat(body.emails()) - .isEqualTo( + .contains( listOf( SandboxIndividualUpdateParams.Email.builder() .data("data") @@ -106,14 +106,14 @@ class SandboxIndividualUpdateParamsTest { .build() ) ) - assertThat(body.encryptedSsn()).isEqualTo("encrypted_ssn") - assertThat(body.ethnicity()).isEqualTo(SandboxIndividualUpdateParams.Ethnicity.ASIAN) - assertThat(body.firstName()).isEqualTo("first_name") - assertThat(body.gender()).isEqualTo(SandboxIndividualUpdateParams.Gender.FEMALE) - assertThat(body.lastName()).isEqualTo("last_name") - assertThat(body.middleName()).isEqualTo("middle_name") + assertThat(body.encryptedSsn()).contains("encrypted_ssn") + assertThat(body.ethnicity()).contains(SandboxIndividualUpdateParams.Ethnicity.ASIAN) + assertThat(body.firstName()).contains("first_name") + assertThat(body.gender()).contains(SandboxIndividualUpdateParams.Gender.FEMALE) + assertThat(body.lastName()).contains("last_name") + assertThat(body.middleName()).contains("middle_name") assertThat(body.phoneNumbers()) - .isEqualTo( + .contains( listOf( SandboxIndividualUpdateParams.PhoneNumber.builder() .data("data") @@ -121,9 +121,9 @@ class SandboxIndividualUpdateParamsTest { .build() ) ) - assertThat(body.preferredName()).isEqualTo("preferred_name") + assertThat(body.preferredName()).contains("preferred_name") assertThat(body.residence()) - .isEqualTo( + .contains( Location.builder() .city("city") .country("country") @@ -135,7 +135,7 @@ class SandboxIndividualUpdateParamsTest { .state("state") .build() ) - assertThat(body.ssn()).isEqualTo("ssn") + assertThat(body.ssn()).contains("ssn") } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt index c5af6b03..85c3dc8c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -146,9 +146,9 @@ class SandboxPaymentCreateParamsTest { .build() val body = params.getBody() assertThat(body).isNotNull - assertThat(body.endDate()).isEqualTo("end_date") + assertThat(body.endDate()).contains("end_date") assertThat(body.payStatements()) - .isEqualTo( + .contains( listOf( SandboxPaymentCreateParams.PayStatement.builder() .earnings( @@ -206,7 +206,7 @@ class SandboxPaymentCreateParamsTest { .build() ) ) - assertThat(body.startDate()).isEqualTo("start_date") + assertThat(body.startDate()).contains("start_date") } @Test