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 @@
{
".": "2.0.0"
".": "3.0.0"
}
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 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/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)

<!-- 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:2.0.0")
implementation("com.tryfinch.api:finch-java:3.0.0")
```

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

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 = "2.0.0" // x-release-please-version
version = "3.0.0" // x-release-please-version
}


Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -130,14 +131,23 @@ class FinchOkHttpClient private constructor() {

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

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

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

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

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

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

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

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

fun fromEnv() = apply { clientOptions.fromEnv() }

fun build(): FinchClient =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -130,14 +131,23 @@ class FinchOkHttpClientAsync private constructor() {

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

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

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

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

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

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

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

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

fun fromEnv() = apply { clientOptions.fromEnv() }

fun build(): FinchClientAsync =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -166,12 +167,21 @@ private constructor(

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 @@ -17,7 +17,9 @@ internal fun <T> List<T>.toImmutable(): List<T> =

@JvmSynthetic
internal fun <K, V> Map<K, V>.toImmutable(): Map<K, V> =
if (isEmpty()) Collections.emptyMap() else Collections.unmodifiableMap(toMap())
if (isEmpty()) immutableEmptyMap() else Collections.unmodifiableMap(toMap())

@JvmSynthetic internal fun <K, V> immutableEmptyMap(): Map<K, V> = Collections.emptyMap()

@JvmSynthetic
internal fun <K : Comparable<K>, V> SortedMap<K, V>.toImmutable(): SortedMap<K, V> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, JsonValue>,
val additionalProperties: Map<String, JsonValue> = immutableEmptyMap(),
) {

fun toBuilder() = Builder().from(this)
Expand All @@ -40,7 +44,6 @@ private constructor(
putAllAdditionalProperties(additionalProperties)
}

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
Expand Down
Loading
Loading