Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.1.1"
".": "3.2.0"
}
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## 3.2.0 (2025-01-08)

Full Changelog: [v3.1.1...v3.2.0](https://github.com/Finch-API/finch-api-java/compare/v3.1.1...v3.2.0)

### Features

* **client:** add various convenience setters to models ([#387](https://github.com/Finch-API/finch-api-java/issues/387)) ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))
* **client:** allow setting arbitrary JSON for top-level body params ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))
* **client:** expose getters for `JsonField` of body params ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))


### Bug Fixes

* **client:** consistently throw on omitting required fields ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))
* **client:** convert `JsonField` containing list type to mutable in builder ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))


### Chores

* **internal:** codegen related update ([#389](https://github.com/Finch-API/finch-api-java/issues/389)) ([75e1dfd](https://github.com/Finch-API/finch-api-java/commit/75e1dfd7cb81654e68221e8426d8d4d27ce8b6e6))


### Styles

* **internal:** explicitly add some method return types ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))
* **internal:** move headers and query params setters below others ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))
* **internal:** simplify existing convenience setters on params ([051f37d](https://github.com/Finch-API/finch-api-java/commit/051f37d5ce901f5a05797d50dad3fc177a893012))

## 3.1.1 (2025-01-07)

Full Changelog: [v3.1.0...v3.1.1](https://github.com/Finch-API/finch-api-java/compare/v3.1.0...v3.1.1)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- x-release-please-start-version -->

[![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.1.1)
[![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.2.0)

<!-- x-release-please-end -->

Expand All @@ -27,7 +27,7 @@ The REST API documentation can be found [in the Finch Documentation Center](htt
<!-- x-release-please-start-version -->

```kotlin
implementation("com.tryfinch.api:finch-java:3.1.1")
implementation("com.tryfinch.api:finch-java:3.2.0")
```

#### Maven
Expand All @@ -36,7 +36,7 @@ implementation("com.tryfinch.api:finch-java:3.1.1")
<dependency>
<groupId>com.tryfinch.api</groupId>
<artifactId>finch-java</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
</dependency>
```

Expand Down Expand Up @@ -369,7 +369,7 @@ $ export FINCH_LOG=debug

This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

allprojects {
group = "com.tryfinch.api"
version = "3.1.1" // x-release-please-version
version = "3.2.0" // x-release-please-version
}


Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@ private constructor(

fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }

fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
}

fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries }

fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken }

fun accessToken(accessToken: Optional<String>) = accessToken(accessToken.orElse(null))

fun clientId(clientId: String?) = apply { this.clientId = clientId }

fun clientId(clientId: Optional<String>) = clientId(clientId.orElse(null))

fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret }

fun clientSecret(clientSecret: Optional<String>) = clientSecret(clientSecret.orElse(null))

fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret }

fun webhookSecret(webhookSecret: Optional<String>) =
webhookSecret(webhookSecret.orElse(null))

fun headers(headers: Headers) = apply {
this.headers.clear()
putAllHeaders(headers)
Expand Down Expand Up @@ -159,29 +182,6 @@ private constructor(

fun removeAllQueryParams(keys: Set<String>) = apply { queryParams.removeAll(keys) }

fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
}

fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries }

fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken }

fun accessToken(accessToken: Optional<String>) = accessToken(accessToken.orElse(null))

fun clientId(clientId: String?) = apply { this.clientId = clientId }

fun clientId(clientId: Optional<String>) = clientId(clientId.orElse(null))

fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret }

fun clientSecret(clientSecret: Optional<String>) = clientSecret(clientSecret.orElse(null))

fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret }

fun webhookSecret(webhookSecret: Optional<String>) =
webhookSecret(webhookSecret.orElse(null))

fun fromEnv() = apply {
System.getenv("FINCH_CLIENT_ID")?.let { clientId(it) }
System.getenv("FINCH_CLIENT_SECRET")?.let { clientSecret(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.http.Headers
Expand All @@ -32,12 +34,20 @@ constructor(

fun redirectUri(): Optional<String> = body.redirectUri()

fun _additionalHeaders(): Headers = additionalHeaders
fun _code(): JsonField<String> = body._code()

fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun _clientId(): JsonField<String> = body._clientId()

fun _clientSecret(): JsonField<String> = body._clientSecret()

fun _redirectUri(): JsonField<String> = body._redirectUri()

fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()

fun _additionalHeaders(): Headers = additionalHeaders

fun _additionalQueryParams(): QueryParams = additionalQueryParams

@JvmSynthetic internal fun getBody(): AccessTokenCreateBody = body

@JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders
Expand All @@ -48,28 +58,60 @@ constructor(
class AccessTokenCreateBody
@JsonCreator
internal constructor(
@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?,
@JsonProperty("code")
@ExcludeMissing
private val code: JsonField<String> = JsonMissing.of(),
@JsonProperty("client_id")
@ExcludeMissing
private val clientId: JsonField<String> = JsonMissing.of(),
@JsonProperty("client_secret")
@ExcludeMissing
private val clientSecret: JsonField<String> = JsonMissing.of(),
@JsonProperty("redirect_uri")
@ExcludeMissing
private val redirectUri: JsonField<String> = JsonMissing.of(),
@JsonAnySetter
private val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

@JsonProperty("code") fun code(): String = code
fun code(): String = code.getRequired("code")

fun clientId(): Optional<String> = Optional.ofNullable(clientId.getNullable("client_id"))

fun clientSecret(): Optional<String> =
Optional.ofNullable(clientSecret.getNullable("client_secret"))

fun redirectUri(): Optional<String> =
Optional.ofNullable(redirectUri.getNullable("redirect_uri"))

@JsonProperty("client_id") fun clientId(): Optional<String> = Optional.ofNullable(clientId)
@JsonProperty("code") @ExcludeMissing fun _code(): JsonField<String> = code

@JsonProperty("client_id") @ExcludeMissing fun _clientId(): JsonField<String> = clientId

@JsonProperty("client_secret")
fun clientSecret(): Optional<String> = Optional.ofNullable(clientSecret)
@ExcludeMissing
fun _clientSecret(): JsonField<String> = clientSecret

@JsonProperty("redirect_uri")
fun redirectUri(): Optional<String> = Optional.ofNullable(redirectUri)
@ExcludeMissing
fun _redirectUri(): JsonField<String> = redirectUri

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

private var validated: Boolean = false

fun validate(): AccessTokenCreateBody = apply {
if (!validated) {
code()
clientId()
clientSecret()
redirectUri()
validated = true
}
}

fun toBuilder() = Builder().from(this)

companion object {
Expand All @@ -79,10 +121,10 @@ constructor(

class Builder {

private var code: String? = null
private var clientId: String? = null
private var clientSecret: String? = null
private var redirectUri: String? = null
private var code: JsonField<String>? = null
private var clientId: JsonField<String> = JsonMissing.of()
private var clientSecret: JsonField<String> = JsonMissing.of()
private var redirectUri: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
Expand All @@ -94,20 +136,25 @@ constructor(
additionalProperties = accessTokenCreateBody.additionalProperties.toMutableMap()
}

fun code(code: String) = apply { this.code = code }
fun code(code: String) = code(JsonField.of(code))

fun clientId(clientId: String?) = apply { this.clientId = clientId }
fun code(code: JsonField<String>) = apply { this.code = code }

fun clientId(clientId: Optional<String>) = clientId(clientId.orElse(null))
fun clientId(clientId: String) = clientId(JsonField.of(clientId))

fun clientSecret(clientSecret: String?) = apply { this.clientSecret = clientSecret }
fun clientId(clientId: JsonField<String>) = apply { this.clientId = clientId }

fun clientSecret(clientSecret: Optional<String>) =
clientSecret(clientSecret.orElse(null))
fun clientSecret(clientSecret: String) = clientSecret(JsonField.of(clientSecret))

fun redirectUri(redirectUri: String?) = apply { this.redirectUri = redirectUri }
fun clientSecret(clientSecret: JsonField<String>) = apply {
this.clientSecret = clientSecret
}

fun redirectUri(redirectUri: Optional<String>) = redirectUri(redirectUri.orElse(null))
fun redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri))

fun redirectUri(redirectUri: JsonField<String>) = apply {
this.redirectUri = redirectUri
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
Expand Down Expand Up @@ -179,17 +226,40 @@ constructor(

fun code(code: String) = apply { body.code(code) }

fun clientId(clientId: String?) = apply { body.clientId(clientId) }
fun code(code: JsonField<String>) = apply { body.code(code) }

fun clientId(clientId: String) = apply { body.clientId(clientId) }

fun clientId(clientId: Optional<String>) = clientId(clientId.orElse(null))
fun clientId(clientId: JsonField<String>) = apply { body.clientId(clientId) }

fun clientSecret(clientSecret: String?) = apply { body.clientSecret(clientSecret) }
fun clientSecret(clientSecret: String) = apply { body.clientSecret(clientSecret) }

fun clientSecret(clientSecret: JsonField<String>) = apply {
body.clientSecret(clientSecret)
}

fun clientSecret(clientSecret: Optional<String>) = clientSecret(clientSecret.orElse(null))
fun redirectUri(redirectUri: String) = apply { body.redirectUri(redirectUri) }

fun redirectUri(redirectUri: String?) = apply { body.redirectUri(redirectUri) }
fun redirectUri(redirectUri: JsonField<String>) = apply { body.redirectUri(redirectUri) }

fun redirectUri(redirectUri: Optional<String>) = redirectUri(redirectUri.orElse(null))
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
body.additionalProperties(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
body.putAdditionalProperty(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
body.putAllAdditionalProperties(additionalBodyProperties)
}

fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }

fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
body.removeAllAdditionalProperties(keys)
}

fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
Expand Down Expand Up @@ -289,25 +359,6 @@ constructor(
additionalQueryParams.removeAll(keys)
}

fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
body.additionalProperties(additionalBodyProperties)
}

fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
body.putAdditionalProperty(key, value)
}

fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
apply {
body.putAllAdditionalProperties(additionalBodyProperties)
}

fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }

fun removeAllAdditionalBodyProperties(keys: Set<String>) = apply {
body.removeAllAdditionalProperties(keys)
}

fun build(): AccessTokenCreateParams =
AccessTokenCreateParams(
body.build(),
Expand Down
Loading
Loading