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 @@
-[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/2.0.0)
+[](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