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 @@
{
".": "4.1.0"
".": "4.2.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 40
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-5d2b3a9cdbcfb6f10b6e621ef7ababbd2701316e5ea1117ced072ab76bdbec34.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-7a816d4a5f0039230590a6662f3513d5756344ca662761ecbc49016593f65836.yml
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 4.2.0 (2025-02-27)

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

### Features

* **api:** api update ([#463](https://github.com/Finch-API/finch-api-java/issues/463)) ([2eb1796](https://github.com/Finch-API/finch-api-java/commit/2eb1796d9d21e25e60b5242041cc7ef9e7e1df0e))
* **client:** allow omitting params object when none required ([#455](https://github.com/Finch-API/finch-api-java/issues/455)) ([cac8229](https://github.com/Finch-API/finch-api-java/commit/cac82298a09597acfa12046c8d6396aa08bb3807))


### Bug Fixes

* **client:** add missing `@JvmStatic` ([#457](https://github.com/Finch-API/finch-api-java/issues/457)) ([258a817](https://github.com/Finch-API/finch-api-java/commit/258a817f842e9344c107586f1ac7c879f6c1e3ae))


### Chores

* **client:** use deep identity methods for primitive array types ([#459](https://github.com/Finch-API/finch-api-java/issues/459)) ([4424710](https://github.com/Finch-API/finch-api-java/commit/4424710651151e1a0a075ee7a4c05ed96dc1ce64))
* **internal:** add async service tests ([#458](https://github.com/Finch-API/finch-api-java/issues/458)) ([4698263](https://github.com/Finch-API/finch-api-java/commit/4698263f9490cc4df1b8412c084c1ade14c38b68))
* **internal:** improve sync service tests ([4698263](https://github.com/Finch-API/finch-api-java/commit/4698263f9490cc4df1b8412c084c1ade14c38b68))
* **internal:** refactor `ServiceParamsTest` ([#460](https://github.com/Finch-API/finch-api-java/issues/460)) ([c375fa6](https://github.com/Finch-API/finch-api-java/commit/c375fa659417a964964c150b7b0f8dc27ceab91f))


### Documentation

* readme parameter tweaks ([4698263](https://github.com/Finch-API/finch-api-java/commit/4698263f9490cc4df1b8412c084c1ade14c38b68))

## 4.1.0 (2025-02-25)

Full Changelog: [v4.0.2...v4.1.0](https://github.com/Finch-API/finch-api-java/compare/v4.0.2...v4.1.0)
Expand Down
34 changes: 12 additions & 22 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/4.1.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/4.2.0)

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

Expand All @@ -23,7 +23,7 @@ The REST API documentation can be found [in the Finch Documentation Center](htt
### Gradle

```kotlin
implementation("com.tryfinch.api:finch-java:4.1.0")
implementation("com.tryfinch.api:finch-java:4.2.0")
```

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

Expand All @@ -56,10 +56,7 @@ FinchClient client = FinchOkHttpClient.builder()
.accessToken("My Access Token")
.build();

HrisDirectoryListParams params = HrisDirectoryListParams.builder()
.candidateId("<candidate id>")
.build();
HrisDirectoryListPage page = client.hris().directory().list(params);
HrisDirectoryListPage page = client.hris().directory().list();
```

## Client configuration
Expand Down Expand Up @@ -98,7 +95,6 @@ FinchClient client = FinchOkHttpClient.builder()
// Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables
.fromEnv()
.accessToken("My Access Token")
.accessToken("My Access Token")
.build();
```

Expand Down Expand Up @@ -145,8 +141,7 @@ FinchClient client = FinchOkHttpClient.builder()
.accessToken("My Access Token")
.build();

HrisDirectoryListParams params = HrisDirectoryListParams.builder().build();
CompletableFuture<HrisDirectoryListPageAsync> page = client.async().hris().directory().list(params);
CompletableFuture<HrisDirectoryListPageAsync> page = client.async().hris().directory().list();
```

Or create an asynchronous client from the beginning:
Expand All @@ -164,8 +159,7 @@ FinchClientAsync client = FinchOkHttpClientAsync.builder()
.accessToken("My Access Token")
.build();

HrisDirectoryListParams params = HrisDirectoryListParams.builder().build();
CompletableFuture<HrisDirectoryListPageAsync> page = client.hris().directory().list(params);
CompletableFuture<HrisDirectoryListPageAsync> page = client.hris().directory().list();
```

The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.
Expand Down Expand Up @@ -295,8 +289,8 @@ import com.tryfinch.api.client.okhttp.FinchOkHttpClient;

FinchClient client = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.maxRetries(4)
.accessToken("My Access Token")
.build();
```

Expand All @@ -310,9 +304,7 @@ To set a custom timeout, configure the method call using the `timeout` method:
import com.tryfinch.api.models.HrisDirectoryListPage;
import com.tryfinch.api.models.HrisDirectoryListParams;

HrisDirectoryListPage page = client.hris().directory().list(
params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()
);
HrisDirectoryListPage page = client.hris().directory().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());
```

Or configure the default for all method calls at the client level:
Expand All @@ -324,8 +316,8 @@ import java.time.Duration;

FinchClient client = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.timeout(Duration.ofSeconds(30))
.accessToken("My Access Token")
.build();
```

Expand All @@ -341,12 +333,12 @@ import java.net.Proxy;

FinchClient client = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.proxy(new Proxy(
Proxy.Type.HTTP, new InetSocketAddress(
"https://example.com", 8080
)
))
.accessToken("My Access Token")
.build();
```

Expand Down Expand Up @@ -453,9 +445,7 @@ Or configure the method call to validate the response using the `responseValidat
import com.tryfinch.api.models.HrisDirectoryListPage;
import com.tryfinch.api.models.HrisDirectoryListParams;

HrisDirectoryListPage page = client.hris().directory().list(
params, RequestOptions.builder().responseValidation(true).build()
);
HrisDirectoryListPage page = client.hris().directory().list(RequestOptions.builder().responseValidation(true).build());
```

Or configure the default for all method calls at the client level:
Expand All @@ -466,8 +456,8 @@ import com.tryfinch.api.client.okhttp.FinchOkHttpClient;

FinchClient client = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.responseValidation(true)
.accessToken("My Access Token")
.build();
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
allprojects {
group = "com.tryfinch.api"
version = "4.1.0" // x-release-please-version
version = "4.2.0" // x-release-please-version
}
36 changes: 36 additions & 0 deletions finch-java-core/src/main/kotlin/com/tryfinch/api/core/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,42 @@ internal fun <K : Comparable<K>, V> SortedMap<K, V>.toImmutable(): SortedMap<K,
if (isEmpty()) Collections.emptySortedMap()
else Collections.unmodifiableSortedMap(toSortedMap(comparator()))

/**
* Returns whether [this] is equal to [other].
*
* This differs from [Object.equals] because it also deeply equates arrays based on their contents,
* even when there are arrays directly nested within other arrays.
*/
@JvmSynthetic
internal infix fun Any?.contentEquals(other: Any?): Boolean =
arrayOf(this).contentDeepEquals(arrayOf(other))

/**
* Returns a hash of the given sequence of [values].
*
* This differs from [java.util.Objects.hash] because it also deeply hashes arrays based on their
* contents, even when there are arrays directly nested within other arrays.
*/
@JvmSynthetic internal fun contentHash(vararg values: Any?): Int = values.contentDeepHashCode()

/**
* Returns a [String] representation of [this].
*
* This differs from [Object.toString] because it also deeply stringifies arrays based on their
* contents, even when there are arrays directly nested within other arrays.
*/
@JvmSynthetic
internal fun Any?.contentToString(): String {
var string = arrayOf(this).contentDeepToString()
if (string.startsWith('[')) {
string = string.substring(1)
}
if (string.endsWith(']')) {
string = string.substring(0, string.length - 1)
}
return string
}

@JvmSynthetic
internal fun Headers.getRequiredHeader(name: String): String =
values(name).firstOrNull() ?: throw FinchInvalidDataException("Could not find $name header")
Expand Down
43 changes: 11 additions & 32 deletions finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt
Original file line number Diff line number Diff line change
Expand Up @@ -470,41 +470,20 @@ internal constructor(
val filename: String? = null,
) {

private var hashCode: Int = 0

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
name,
contentType,
filename,
when (value) {
is ByteArray -> value.contentHashCode()
is String -> value
is Boolean -> value
is Long -> value
is Double -> value
else -> value?.hashCode()
},
)
}
return hashCode
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this.javaClass != other.javaClass) return false
private val hashCode: Int by lazy { contentHash(name, value, contentType, filename) }

other as MultipartFormValue<*>
override fun hashCode(): Int = hashCode

if (name != other.name || contentType != other.contentType || filename != other.filename)
return false

return when {
value is ByteArray && other.value is ByteArray -> value contentEquals other.value
else -> value?.equals(other.value) ?: (other.value == null)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is MultipartFormValue<*> &&
name == other.name &&
value contentEquals other.value &&
contentType == other.contentType &&
filename == other.filename
}

override fun toString(): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ private constructor(

companion object {

@JvmStatic fun none(): AccountDisconnectParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private constructor(

companion object {

@JvmStatic fun none(): AccountIntrospectParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisBenefitCreateParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisBenefitListParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisBenefitListSupportedBenefitsParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisCompanyRetrieveParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisDirectoryListIndividualsParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisDirectoryListParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisDocumentListParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ private constructor(

companion object {

@JvmStatic fun none(): HrisIndividualRetrieveManyParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ private constructor(

companion object {

@JvmStatic fun none(): JobAutomatedCreateParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ private constructor(

companion object {

@JvmStatic fun none(): JobAutomatedListParams = builder().build()

@JvmStatic fun builder() = Builder()
}

Expand Down
Loading