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
8 changes: 5 additions & 3 deletions .github/workflows/publish-sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ jobs:
uses: gradle/gradle-build-action@v2

- name: Publish to Sonatype
run: |
./gradlew --parallel --no-daemon publish
run: |-
export -- GPG_SIGNING_KEY_ID
printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD"
GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')"
./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD"
env:
SONATYPE_USERNAME: ${{ secrets.FINCH_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.FINCH_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
GPG_SIGNING_KEY_ID: ${{ secrets.FINCH_SONATYPE_GPG_SIGNING_KEY_ID || secrets.GPG_SIGNING_KEY_ID }}
GPG_SIGNING_KEY: ${{ secrets.FINCH_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSWORD: ${{ secrets.FINCH_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }}
1 change: 0 additions & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ jobs:
env:
SONATYPE_USERNAME: ${{ secrets.FINCH_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.FINCH_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
GPG_SIGNING_KEY_ID: ${{ secrets.FINCH_SONATYPE_GPG_SIGNING_KEY_ID || secrets.GPG_SIGNING_KEY_ID }}
GPG_SIGNING_KEY: ${{ secrets.FINCH_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSWORD: ${{ secrets.FINCH_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.11.1"
".": "1.12.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: 38
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-c7c3b67aee7f77702be22b17af22bdf799b8c95be8028f20ac406af8b5ec0439.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-2526a31a361274411e6cfc64858b1b084a22ffb491a9490374b717534827b3e1.yml
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 1.12.0 (2024-11-27)

Full Changelog: [v1.11.1...v1.12.0](https://github.com/Finch-API/finch-api-java/compare/v1.11.1...v1.12.0)

### Features

* **api:** api update ([#344](https://github.com/Finch-API/finch-api-java/issues/344)) ([995447b](https://github.com/Finch-API/finch-api-java/commit/995447bc6ce0c99dd0fef03af69574ad028fb2cc))
* derive gpg release key's id via gpg itself ([#341](https://github.com/Finch-API/finch-api-java/issues/341)) ([5d9b02d](https://github.com/Finch-API/finch-api-java/commit/5d9b02de8fa17a49a1d05e71aea488007d6db1a4))


### Bug Fixes

* remove reference to removed deps 'guava' ([ab6b83c](https://github.com/Finch-API/finch-api-java/commit/ab6b83ceff97195bced4391a82dc4fafe086ad3e))


### Chores

* fix formatting ([a8911c2](https://github.com/Finch-API/finch-api-java/commit/a8911c2030d43fa0de1e13428378a099366a22b4))
* **internal:** codegen changes ([#340](https://github.com/Finch-API/finch-api-java/issues/340)) ([3c5d768](https://github.com/Finch-API/finch-api-java/commit/3c5d768f7a1511c6625b6008f3140c5a7ad1e3cd))
* **internal:** codegen changes ([#342](https://github.com/Finch-API/finch-api-java/issues/342)) ([3876694](https://github.com/Finch-API/finch-api-java/commit/3876694b22866aeed1e47ab17264f253001d9290))
* **internal:** codegen related update ([#335](https://github.com/Finch-API/finch-api-java/issues/335)) ([4c594c8](https://github.com/Finch-API/finch-api-java/commit/4c594c8869c07387731fdde4519575bb93f865e5))
* **internal:** codegen related update ([#337](https://github.com/Finch-API/finch-api-java/issues/337)) ([586ee38](https://github.com/Finch-API/finch-api-java/commit/586ee38c5744b36d44dd42756cc74bf1d542ca56))
* **internal:** codegen related update ([#343](https://github.com/Finch-API/finch-api-java/issues/343)) ([2827201](https://github.com/Finch-API/finch-api-java/commit/28272014e7a7c5439b369c92d336c9247f226368))
* **internal:** update example values ([#339](https://github.com/Finch-API/finch-api-java/issues/339)) ([de78eab](https://github.com/Finch-API/finch-api-java/commit/de78eab92fb90d7d324d99f93f6dbb4d0e7e3cd0))

## 1.11.1 (2024-11-20)

Full Changelog: [v1.11.0...v1.11.1](https://github.com/Finch-API/finch-api-java/compare/v1.11.0...v1.11.1)
Expand Down
22 changes: 19 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/1.11.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/1.12.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:1.11.1")
implementation("com.tryfinch.api:finch-java:1.12.0")
```

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

Expand Down Expand Up @@ -294,6 +294,22 @@ FinchClient client = FinchOkHttpClient.builder()
.build();
```

## Logging

We use the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).

You can enable logging by setting the environment variable `FINCH_LOG` to `info`.

```sh
$ export FINCH_LOG=info
```

Or to `debug` for more verbose logging.

```sh
$ export FINCH_LOG=debug
```

## Semantic versioning

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:
Expand Down
14 changes: 2 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"

}

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

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
plugins {
`kotlin-dsl`
kotlin("jvm") version "1.9.22"
id("com.vanniktech.maven.publish") version "0.28.0"
}

repositories {
gradlePluginPortal()
mavenCentral()
}

dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
}
14 changes: 4 additions & 10 deletions buildSrc/src/main/kotlin/finch.java.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import java.util.Locale
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost

plugins {
`java-library`
Expand All @@ -11,11 +14,6 @@ repositories {
mavenCentral()
}

configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
}

configure<SpotlessExtension> {
java {
importOrder()
Expand All @@ -36,10 +34,6 @@ tasks.withType<JavaCompile>().configureEach {
options.release.set(8)
}

tasks.named<Jar>("javadocJar") {
setZip64(true)
}

tasks.named<Jar>("jar") {
manifest {
attributes(mapOf(
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/finch.kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.vanniktech.maven.publish.*

plugins {
id("finch.java")
Expand Down
83 changes: 35 additions & 48 deletions buildSrc/src/main/kotlin/finch.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,52 @@ import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.get
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost

plugins {
`maven-publish`
`signing`
id("com.vanniktech.maven.publish")
}

configure<PublishingExtension> {
publications {
register<MavenPublication>("maven") {
from(components["java"])
repositories {
gradlePluginPortal()
mavenCentral()
}

pom {
name.set("API Reference")
description.set("The Finch HRIS API provides a unified way to connect to a multitide of HRIS\nsystems. The API requires an access token issued by Finch.\n\nBy default, Organization and Payroll requests use Finch's\n[Data Syncs](/developer-resources/Data-Syncs). If a request is made before the\ninitial sync has completed, Finch will request data live from the provider. The\nlatency on live requests may range from seconds to minutes depending on the\nprovider and batch size. For automated integrations, Deductions requests (both\nread and write) are always made live to the provider. Latencies may range from\nseconds to minutes depending on the provider and batch size.\n\nEmployer products are specified by the product parameter, a space-separated list\nof products that your application requests from an employer authenticating\nthrough Finch Connect. Valid product names are—\n\n- `company`: Read basic company data\n\n- `directory`: Read company directory and organization structure\n\n- `individual`: Read individual data, excluding income and employment data\n\n- `employment`: Read individual employment and income data\n\n- `payment`: Read payroll and contractor related payments by the company\n\n- `pay_statement`: Read detailed pay statements for each individual\n\n- `benefits`: Create and manage deductions and contributions and enrollment for\n an employer\n\n[![Open in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4?action=collection%2Ffork&collection-url=entityId%3D21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4%26entityType%3Dcollection%26workspaceId%3D1edf19bc-e0a8-41e9-ac55-481a4b50790b)")
url.set("https://developer.tryfinch.com/")
extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY")
extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID")
extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD")

licenses {
license {
name.set("Apache-2.0")
}
}
configure<MavenPublishBaseExtension> {
signAllPublications()
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

developers {
developer {
name.set("Finch")
email.set("founders@tryfinch.com")
}
}
this.coordinates(project.group.toString(), project.name, project.version.toString())

scm {
connection.set("scm:git:git://github.com/Finch-API/finch-api-java.git")
developerConnection.set("scm:git:git://github.com/Finch-API/finch-api-java.git")
url.set("https://github.com/Finch-API/finch-api-java")
}
pom {
name.set("API Reference")
description.set("The Finch HRIS API provides a unified way to connect to a multitide of HRIS\nsystems. The API requires an access token issued by Finch.\n\nBy default, Organization and Payroll requests use Finch's\n[Data Syncs](/developer-resources/Data-Syncs). If a request is made before the\ninitial sync has completed, Finch will request data live from the provider. The\nlatency on live requests may range from seconds to minutes depending on the\nprovider and batch size. For automated integrations, Deductions requests (both\nread and write) are always made live to the provider. Latencies may range from\nseconds to minutes depending on the provider and batch size.\n\nEmployer products are specified by the product parameter, a space-separated list\nof products that your application requests from an employer authenticating\nthrough Finch Connect. Valid product names are—\n\n- `company`: Read basic company data\n\n- `directory`: Read company directory and organization structure\n\n- `individual`: Read individual data, excluding income and employment data\n\n- `employment`: Read individual employment and income data\n\n- `payment`: Read payroll and contractor related payments by the company\n\n- `pay_statement`: Read detailed pay statements for each individual\n\n- `benefits`: Create and manage deductions and contributions and enrollment for\n an employer\n\n[![Open in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4?action=collection%2Ffork&collection-url=entityId%3D21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4%26entityType%3Dcollection%26workspaceId%3D1edf19bc-e0a8-41e9-ac55-481a4b50790b)")
url.set("https://developer.tryfinch.com/")

versionMapping {
allVariants {
fromResolutionResult()
}
}
licenses {
license {
name.set("Apache-2.0")
}
}
}
}

signing {
val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null }
val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null }
val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null }
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(
signingKeyId,
signingKey,
signingPassword,
)
sign(publishing.publications["maven"])
}
}
developers {
developer {
name.set("Finch")
email.set("founders@tryfinch.com")
}
}

tasks.named("publish") {
dependsOn(":closeAndReleaseSonatypeStagingRepository")
scm {
connection.set("scm:git:git://github.com/Finch-API/finch-api-java.git")
developerConnection.set("scm:git:git://github.com/Finch-API/finch-api-java.git")
url.set("https://github.com/Finch-API/finch-api-java")
}
}
}
1 change: 1 addition & 0 deletions finch-java-client-okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies {
api(project(":finch-java-core"))

implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

testImplementation(kotlin("test"))
testImplementation("org.assertj:assertj-core:3.25.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,38 @@ import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink

class OkHttpClient
private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
HttpClient {

private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient {
val timeout = requestOptions.timeout ?: return okHttpClient
return okHttpClient
.newBuilder()
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
.build()
val clientBuilder = okHttpClient.newBuilder()

val logLevel =
when (System.getenv("FINCH_LOG")?.lowercase()) {
"info" -> HttpLoggingInterceptor.Level.BASIC
"debug" -> HttpLoggingInterceptor.Level.BODY
else -> null
}
if (logLevel != null) {
clientBuilder.addNetworkInterceptor(
HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") }
)
}

val timeout = requestOptions.timeout
if (timeout != null) {
clientBuilder
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
}

return clientBuilder.build()
}

override fun execute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ private constructor(
val additionalProperties: Map<String, JsonValue>,
) {

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is FinchError && this.additionalProperties == other.additionalProperties /* spotless:on */
}

override fun hashCode(): Int {
return /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */
}

override fun toString() = "FinchError{additionalProperties=$additionalProperties}"

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

companion object {
Expand Down Expand Up @@ -71,4 +57,16 @@ private constructor(

fun build(): FinchError = FinchError(additionalProperties.toImmutable())
}

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return /* spotless:off */ other is FinchError && additionalProperties == other.additionalProperties /* spotless:on */
}

override fun hashCode(): Int = /* spotless:off */ Objects.hash(additionalProperties) /* spotless:on */

override fun toString() = "FinchError{additionalProperties=$additionalProperties}"
}
Loading