diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml
index 0512f7a2..2499cfae 100644
--- a/.github/workflows/publish-sonatype.yml
+++ b/.github/workflows/publish-sonatype.yml
@@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Java
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: temurin
java-version: |
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b1028a56..037c241f 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "7.3.1"
+ ".": "7.4.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 1889fe28..cedd110a 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 45
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f7e741bc6e0175fd96a9db5348092b90a77b0985154c0814bb681ad5dccdf19a.yml
-openapi_spec_hash: b348a9ef407a8e91dd770fcb219d4ac5
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-73c284d36c1ed2d9963fc733e421005fad76e559de8efe9baa6511a43dd72668.yml
+openapi_spec_hash: 1e58c4445919b71c77e5c7f16bd6fa7d
config_hash: 5146b12344dae76238940989dac1e8a0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1c5cc6b..f847bdfb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,39 @@
# Changelog
+## 7.4.0 (2025-07-24)
+
+Full Changelog: [v7.3.1...v7.4.0](https://github.com/Finch-API/finch-api-java/compare/v7.3.1...v7.4.0)
+
+### Features
+
+* **api:** api update ([f1f21d9](https://github.com/Finch-API/finch-api-java/commit/f1f21d90ad56582d33c0e1f8b7248cba3ccf381a))
+* **api:** api update ([21939b3](https://github.com/Finch-API/finch-api-java/commit/21939b3e793ae932cfe333a50e4996388900464f))
+* **client:** add `{QueryParams,Headers}#put(String, JsonValue)` methods ([c85d73a](https://github.com/Finch-API/finch-api-java/commit/c85d73ace557d4a52fadccbfca80ebf81a63c15d))
+* **client:** add https config options ([4ae1b1a](https://github.com/Finch-API/finch-api-java/commit/4ae1b1ad7b9ba3f76f027ae32e5bee6525706dd5))
+* **client:** allow configuring env via system properties ([acdb059](https://github.com/Finch-API/finch-api-java/commit/acdb059e62754399064125ff41c1d5a2ac1305ab))
+
+
+### Bug Fixes
+
+* **client:** accidental mutability of some classes ([f1e80c0](https://github.com/Finch-API/finch-api-java/commit/f1e80c04aca7aa069e3a653252705e1e32d3d018))
+* **client:** ensure error handling always occurs ([98e72bc](https://github.com/Finch-API/finch-api-java/commit/98e72bc3ee2085f94175a8326f2bc75c11dca281))
+* **internal:** fix error handlers on ClientImpl ([8cfda8e](https://github.com/Finch-API/finch-api-java/commit/8cfda8eb135f79e051f882b23eeb61e18367da5b))
+* use errorHandler ([f1f1119](https://github.com/Finch-API/finch-api-java/commit/f1f11199de44aa3277553ffdfa35715e966bc13c))
+
+
+### Chores
+
+* **ci:** bump `actions/setup-java` to v4 ([a15c7b6](https://github.com/Finch-API/finch-api-java/commit/a15c7b62eedd8278ea6f4cc65dc1211b3d2c92da))
+* **internal:** allow running specific example from cli ([c1eebc5](https://github.com/Finch-API/finch-api-java/commit/c1eebc5989312477b4c60d26e21e7b59e43a6c1d))
+* **internal:** refactor delegating from client to options ([e9e1c40](https://github.com/Finch-API/finch-api-java/commit/e9e1c400440734ec210fc759149de5b014102d11))
+* **internal:** remove unnecessary `[...]` in `[@see](https://github.com/see)` ([8b2df3c](https://github.com/Finch-API/finch-api-java/commit/8b2df3cab95afc11b9275bbce043a7ba061a1c26))
+
+
+### Documentation
+
+* fix missing readme comment ([32795c6](https://github.com/Finch-API/finch-api-java/commit/32795c657795d4855a237d88ef8509cd6c420aee))
+* more code comments ([7e48fcf](https://github.com/Finch-API/finch-api-java/commit/7e48fcff3d3c3a80fae1585250d7ae9767a8cea7))
+
## 7.3.1 (2025-07-08)
Full Changelog: [v7.3.0...v7.3.1](https://github.com/Finch-API/finch-api-java/compare/v7.3.0...v7.3.1)
diff --git a/README.md b/README.md
index 3fd8d0c8..a6555c8b 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/7.3.1)
-[](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.3.1)
+[](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/7.4.0)
+[](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.4.0)
@@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).
-The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.3.1).
+The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/7.4.0).
@@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.tryfinch.com](https://deve
### Gradle
```kotlin
-implementation("com.tryfinch.api:finch-java:7.3.1")
+implementation("com.tryfinch.api:finch-java:7.4.0")
```
### Maven
@@ -35,7 +35,7 @@ implementation("com.tryfinch.api:finch-java:7.3.1")
com.tryfinch.api
finch-java
- 7.3.1
+ 7.4.0
```
@@ -54,7 +54,8 @@ import com.tryfinch.api.models.HrisDirectoryListPage;
import com.tryfinch.api.models.HrisDirectoryListParams;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
+ // Configures using the `finch.clientId`, `finch.clientSecret`, `finch.webhookSecret` and `finch.baseUrl` system properties
+ // Or configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -64,14 +65,15 @@ HrisDirectoryListPage page = client.hris().directory().list();
## Client configuration
-Configure the client using environment variables:
+Configure the client using system properties or environment variables:
```java
import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
+ // Configures using the `finch.clientId`, `finch.clientSecret`, `finch.webhookSecret` and `finch.baseUrl` system properties
+ // Or configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -95,7 +97,8 @@ import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
+ // Configures using the `finch.clientId`, `finch.clientSecret`, `finch.webhookSecret` and `finch.baseUrl` system properties
+ // Or configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -103,12 +106,14 @@ FinchClient client = FinchOkHttpClient.builder()
See this table for the available options:
-| Setter | Environment variable | Required | Default value |
-| --------------- | ---------------------- | -------- | ---------------------------- |
-| `clientId` | `FINCH_CLIENT_ID` | false | - |
-| `clientSecret` | `FINCH_CLIENT_SECRET` | false | - |
-| `webhookSecret` | `FINCH_WEBHOOK_SECRET` | false | - |
-| `baseUrl` | `FINCH_BASE_URL` | true | `"https://api.tryfinch.com"` |
+| Setter | System property | Environment variable | Required | Default value |
+| --------------- | --------------------- | ---------------------- | -------- | ---------------------------- |
+| `clientId` | `finch.clientId` | `FINCH_CLIENT_ID` | false | - |
+| `clientSecret` | `finch.clientSecret` | `FINCH_CLIENT_SECRET` | false | - |
+| `webhookSecret` | `finch.webhookSecret` | `FINCH_WEBHOOK_SECRET` | false | - |
+| `baseUrl` | `finch.baseUrl` | `FINCH_BASE_URL` | true | `"https://api.tryfinch.com"` |
+
+System properties take precedence over environment variables.
> [!TIP]
> Don't create more than one client in the same application. Each client has a connection pool and
@@ -155,7 +160,8 @@ import com.tryfinch.api.models.HrisDirectoryListParams;
import java.util.concurrent.CompletableFuture;
FinchClient client = FinchOkHttpClient.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
+ // Configures using the `finch.clientId`, `finch.clientSecret`, `finch.webhookSecret` and `finch.baseUrl` system properties
+ // Or configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -173,7 +179,8 @@ import com.tryfinch.api.models.HrisDirectoryListParams;
import java.util.concurrent.CompletableFuture;
FinchClientAsync client = FinchOkHttpClientAsync.builder()
- // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
+ // Configures using the `finch.clientId`, `finch.clientSecret`, `finch.webhookSecret` and `finch.baseUrl` system properties
+ // Or configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET`, `FINCH_WEBHOOK_SECRET` and `FINCH_BASE_URL` environment variables
.fromEnv()
.accessToken("My Access Token")
.build();
@@ -373,7 +380,7 @@ If the SDK threw an exception, but you're _certain_ the version is compatible, t
### Retries
-The SDK automatically retries 2 times by default, with a short exponential backoff.
+The SDK automatically retries 2 times by default, with a short exponential backoff between requests.
Only the following error types are retried:
@@ -383,7 +390,7 @@ Only the following error types are retried:
- 429 Rate Limit
- 5xx Internal
-The API may also explicitly instruct the SDK to retry or not retry a response.
+The API may also explicitly instruct the SDK to retry or not retry a request.
To set a custom number of retries, configure the client using the `maxRetries` method:
@@ -445,6 +452,28 @@ FinchClient client = FinchOkHttpClient.builder()
.build();
```
+### HTTPS
+
+> [!NOTE]
+> Most applications should not call these methods, and instead use the system defaults. The defaults include
+> special optimizations that can be lost if the implementations are modified.
+
+To configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:
+
+```java
+import com.tryfinch.api.client.FinchClient;
+import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
+
+FinchClient client = FinchOkHttpClient.builder()
+ .fromEnv()
+ // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.
+ .sslSocketFactory(yourSSLSocketFactory)
+ .trustManager(yourTrustManager)
+ .hostnameVerifier(yourHostnameVerifier)
+ .accessToken("My Access Token")
+ .build();
+```
+
### Custom HTTP client
The SDK consists of three artifacts:
diff --git a/build.gradle.kts b/build.gradle.kts
index 7464272e..82ff7f2f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.tryfinch.api"
- version = "7.3.1" // x-release-please-version
+ version = "7.4.0" // x-release-please-version
}
subprojects {
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 ea6fc295..a41f3cdd 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
@@ -7,22 +7,37 @@ import com.tryfinch.api.client.FinchClient
import com.tryfinch.api.client.FinchClientImpl
import com.tryfinch.api.core.ClientOptions
import com.tryfinch.api.core.Timeout
+import com.tryfinch.api.core.http.AsyncStreamResponse
import com.tryfinch.api.core.http.Headers
+import com.tryfinch.api.core.http.HttpClient
import com.tryfinch.api.core.http.QueryParams
+import com.tryfinch.api.core.jsonMapper
import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
import java.util.concurrent.Executor
+import javax.net.ssl.HostnameVerifier
+import javax.net.ssl.SSLSocketFactory
+import javax.net.ssl.X509TrustManager
import kotlin.jvm.optionals.getOrNull
+/**
+ * A class that allows building an instance of [FinchClient] with [OkHttpClient] as the underlying
+ * [HttpClient].
+ */
class FinchOkHttpClient private constructor() {
companion object {
- /** Returns a mutable builder for constructing an instance of [FinchOkHttpClient]. */
+ /** Returns a mutable builder for constructing an instance of [FinchClient]. */
@JvmStatic fun builder() = Builder()
+ /**
+ * Returns a client configured using system properties and environment variables.
+ *
+ * @see ClientOptions.Builder.fromEnv
+ */
@JvmStatic fun fromEnv(): FinchClient = builder().fromEnv().build()
}
@@ -30,10 +45,63 @@ class FinchOkHttpClient private constructor() {
class Builder internal constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
- private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
+ private var sslSocketFactory: SSLSocketFactory? = null
+ private var trustManager: X509TrustManager? = null
+ private var hostnameVerifier: HostnameVerifier? = null
+
+ fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+
+ /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
+ fun proxy(proxy: Optional) = proxy(proxy.getOrNull())
+
+ /**
+ * The socket factory used to secure HTTPS connections.
+ *
+ * If this is set, then [trustManager] must also be set.
+ *
+ * If unset, then the system default is used. Most applications should not call this method,
+ * and instead use the system default. The default include special optimizations that can be
+ * lost if the implementation is modified.
+ */
+ fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply {
+ this.sslSocketFactory = sslSocketFactory
+ }
+
+ /** Alias for calling [Builder.sslSocketFactory] with `sslSocketFactory.orElse(null)`. */
+ fun sslSocketFactory(sslSocketFactory: Optional) =
+ sslSocketFactory(sslSocketFactory.getOrNull())
+
+ /**
+ * The trust manager used to secure HTTPS connections.
+ *
+ * If this is set, then [sslSocketFactory] must also be set.
+ *
+ * If unset, then the system default is used. Most applications should not call this method,
+ * and instead use the system default. The default include special optimizations that can be
+ * lost if the implementation is modified.
+ */
+ fun trustManager(trustManager: X509TrustManager?) = apply {
+ this.trustManager = trustManager
+ }
+
+ /** Alias for calling [Builder.trustManager] with `trustManager.orElse(null)`. */
+ fun trustManager(trustManager: Optional) =
+ trustManager(trustManager.getOrNull())
+
+ /**
+ * The verifier used to confirm that response certificates apply to requested hostnames for
+ * HTTPS connections.
+ *
+ * If unset, then a default hostname verifier is used.
+ */
+ fun hostnameVerifier(hostnameVerifier: HostnameVerifier?) = apply {
+ this.hostnameVerifier = hostnameVerifier
+ }
- fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) }
+ /** Alias for calling [Builder.hostnameVerifier] with `hostnameVerifier.orElse(null)`. */
+ fun hostnameVerifier(hostnameVerifier: Optional) =
+ hostnameVerifier(hostnameVerifier.getOrNull())
/**
* Whether to throw an exception if any of the Jackson versions detected at runtime are
@@ -46,14 +114,109 @@ class FinchOkHttpClient private constructor() {
clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility)
}
+ /**
+ * The Jackson JSON mapper to use for serializing and deserializing JSON.
+ *
+ * Defaults to [com.tryfinch.api.core.jsonMapper]. The default is usually sufficient and
+ * rarely needs to be overridden.
+ */
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ */
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
}
+ /**
+ * The clock to use for operations that require timing, like retries.
+ *
+ * This is primarily useful for using a fake clock in tests.
+ *
+ * Defaults to [Clock.systemUTC].
+ */
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }
+ /**
+ * The base URL to use for every request.
+ *
+ * Defaults to the production environment: `https://api.tryfinch.com`.
+ */
+ fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) }
+
+ /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
+ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull())
+
+ /**
+ * Whether to call `validate` on every response before returning it.
+ *
+ * Defaults to false, which means the shape of the response will not be validated upfront.
+ * Instead, validation will only occur for the parts of the response that are accessed.
+ */
+ fun responseValidation(responseValidation: Boolean) = apply {
+ clientOptions.responseValidation(responseValidation)
+ }
+
+ /**
+ * Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding
+ * retries.
+ *
+ * Defaults to [Timeout.default].
+ */
+ fun timeout(timeout: Timeout) = apply { clientOptions.timeout(timeout) }
+
+ /**
+ * Sets the maximum time allowed for a complete HTTP call, not including retries.
+ *
+ * See [Timeout.request] for more details.
+ *
+ * For fine-grained control, pass a [Timeout] object.
+ */
+ fun timeout(timeout: Duration) = apply { clientOptions.timeout(timeout) }
+
+ /**
+ * The maximum number of times to retry failed requests, with a short exponential backoff
+ * between requests.
+ *
+ * Only the following error types are retried:
+ * - Connection errors (for example, due to a network connectivity problem)
+ * - 408 Request Timeout
+ * - 409 Conflict
+ * - 429 Rate Limit
+ * - 5xx Internal
+ *
+ * The API may also explicitly instruct the SDK to retry or not retry a request.
+ *
+ * Defaults to 2.
+ */
+ fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
+
+ fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) }
+
+ /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */
+ fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull())
+
+ fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) }
+
+ /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */
+ fun clientId(clientId: Optional) = clientId(clientId.getOrNull())
+
+ fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) }
+
+ /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */
+ fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull())
+
+ fun webhookSecret(webhookSecret: String?) = apply {
+ clientOptions.webhookSecret(webhookSecret)
+ }
+
+ /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */
+ fun webhookSecret(webhookSecret: Optional) =
+ webhookSecret(webhookSecret.getOrNull())
+
fun headers(headers: Headers) = apply { clientOptions.headers(headers) }
fun headers(headers: Map>) = apply {
@@ -134,51 +297,11 @@ class FinchOkHttpClient private constructor() {
clientOptions.removeAllQueryParams(keys)
}
- fun timeout(timeout: Timeout) = apply {
- clientOptions.timeout(timeout)
- this.timeout = timeout
- }
-
/**
- * Sets the maximum time allowed for a complete HTTP call, not including retries.
+ * Updates configuration using system properties and environment variables.
*
- * See [Timeout.request] for more details.
- *
- * For fine-grained control, pass a [Timeout] object.
+ * @see ClientOptions.Builder.fromEnv
*/
- fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
-
- fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
-
- fun proxy(proxy: Proxy) = apply { this.proxy = proxy }
-
- fun responseValidation(responseValidation: Boolean) = apply {
- clientOptions.responseValidation(responseValidation)
- }
-
- fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) }
-
- /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */
- fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull())
-
- fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) }
-
- /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */
- fun clientId(clientId: Optional) = clientId(clientId.getOrNull())
-
- fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) }
-
- /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */
- fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull())
-
- fun webhookSecret(webhookSecret: String?) = apply {
- clientOptions.webhookSecret(webhookSecret)
- }
-
- /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */
- fun webhookSecret(webhookSecret: Optional) =
- webhookSecret(webhookSecret.getOrNull())
-
fun fromEnv() = apply { clientOptions.fromEnv() }
/**
@@ -189,7 +312,15 @@ class FinchOkHttpClient private constructor() {
fun build(): FinchClient =
FinchClientImpl(
clientOptions
- .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
+ .httpClient(
+ OkHttpClient.builder()
+ .timeout(clientOptions.timeout())
+ .proxy(proxy)
+ .sslSocketFactory(sslSocketFactory)
+ .trustManager(trustManager)
+ .hostnameVerifier(hostnameVerifier)
+ .build()
+ )
.build()
)
}
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 158818cc..23d05eb1 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
@@ -7,22 +7,37 @@ import com.tryfinch.api.client.FinchClientAsync
import com.tryfinch.api.client.FinchClientAsyncImpl
import com.tryfinch.api.core.ClientOptions
import com.tryfinch.api.core.Timeout
+import com.tryfinch.api.core.http.AsyncStreamResponse
import com.tryfinch.api.core.http.Headers
+import com.tryfinch.api.core.http.HttpClient
import com.tryfinch.api.core.http.QueryParams
+import com.tryfinch.api.core.jsonMapper
import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
import java.util.concurrent.Executor
+import javax.net.ssl.HostnameVerifier
+import javax.net.ssl.SSLSocketFactory
+import javax.net.ssl.X509TrustManager
import kotlin.jvm.optionals.getOrNull
+/**
+ * A class that allows building an instance of [FinchClientAsync] with [OkHttpClient] as the
+ * underlying [HttpClient].
+ */
class FinchOkHttpClientAsync private constructor() {
companion object {
- /** Returns a mutable builder for constructing an instance of [FinchOkHttpClientAsync]. */
+ /** Returns a mutable builder for constructing an instance of [FinchClientAsync]. */
@JvmStatic fun builder() = Builder()
+ /**
+ * Returns a client configured using system properties and environment variables.
+ *
+ * @see ClientOptions.Builder.fromEnv
+ */
@JvmStatic fun fromEnv(): FinchClientAsync = builder().fromEnv().build()
}
@@ -30,10 +45,63 @@ class FinchOkHttpClientAsync private constructor() {
class Builder internal constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
- private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
+ private var sslSocketFactory: SSLSocketFactory? = null
+ private var trustManager: X509TrustManager? = null
+ private var hostnameVerifier: HostnameVerifier? = null
+
+ fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+
+ /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */
+ fun proxy(proxy: Optional) = proxy(proxy.getOrNull())
+
+ /**
+ * The socket factory used to secure HTTPS connections.
+ *
+ * If this is set, then [trustManager] must also be set.
+ *
+ * If unset, then the system default is used. Most applications should not call this method,
+ * and instead use the system default. The default include special optimizations that can be
+ * lost if the implementation is modified.
+ */
+ fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply {
+ this.sslSocketFactory = sslSocketFactory
+ }
+
+ /** Alias for calling [Builder.sslSocketFactory] with `sslSocketFactory.orElse(null)`. */
+ fun sslSocketFactory(sslSocketFactory: Optional) =
+ sslSocketFactory(sslSocketFactory.getOrNull())
+
+ /**
+ * The trust manager used to secure HTTPS connections.
+ *
+ * If this is set, then [sslSocketFactory] must also be set.
+ *
+ * If unset, then the system default is used. Most applications should not call this method,
+ * and instead use the system default. The default include special optimizations that can be
+ * lost if the implementation is modified.
+ */
+ fun trustManager(trustManager: X509TrustManager?) = apply {
+ this.trustManager = trustManager
+ }
+
+ /** Alias for calling [Builder.trustManager] with `trustManager.orElse(null)`. */
+ fun trustManager(trustManager: Optional) =
+ trustManager(trustManager.getOrNull())
+
+ /**
+ * The verifier used to confirm that response certificates apply to requested hostnames for
+ * HTTPS connections.
+ *
+ * If unset, then a default hostname verifier is used.
+ */
+ fun hostnameVerifier(hostnameVerifier: HostnameVerifier?) = apply {
+ this.hostnameVerifier = hostnameVerifier
+ }
- fun baseUrl(baseUrl: String) = apply { clientOptions.baseUrl(baseUrl) }
+ /** Alias for calling [Builder.hostnameVerifier] with `hostnameVerifier.orElse(null)`. */
+ fun hostnameVerifier(hostnameVerifier: Optional) =
+ hostnameVerifier(hostnameVerifier.getOrNull())
/**
* Whether to throw an exception if any of the Jackson versions detected at runtime are
@@ -46,14 +114,109 @@ class FinchOkHttpClientAsync private constructor() {
clientOptions.checkJacksonVersionCompatibility(checkJacksonVersionCompatibility)
}
+ /**
+ * The Jackson JSON mapper to use for serializing and deserializing JSON.
+ *
+ * Defaults to [com.tryfinch.api.core.jsonMapper]. The default is usually sufficient and
+ * rarely needs to be overridden.
+ */
fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) }
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ */
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
}
+ /**
+ * The clock to use for operations that require timing, like retries.
+ *
+ * This is primarily useful for using a fake clock in tests.
+ *
+ * Defaults to [Clock.systemUTC].
+ */
fun clock(clock: Clock) = apply { clientOptions.clock(clock) }
+ /**
+ * The base URL to use for every request.
+ *
+ * Defaults to the production environment: `https://api.tryfinch.com`.
+ */
+ fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) }
+
+ /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
+ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull())
+
+ /**
+ * Whether to call `validate` on every response before returning it.
+ *
+ * Defaults to false, which means the shape of the response will not be validated upfront.
+ * Instead, validation will only occur for the parts of the response that are accessed.
+ */
+ fun responseValidation(responseValidation: Boolean) = apply {
+ clientOptions.responseValidation(responseValidation)
+ }
+
+ /**
+ * Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding
+ * retries.
+ *
+ * Defaults to [Timeout.default].
+ */
+ fun timeout(timeout: Timeout) = apply { clientOptions.timeout(timeout) }
+
+ /**
+ * Sets the maximum time allowed for a complete HTTP call, not including retries.
+ *
+ * See [Timeout.request] for more details.
+ *
+ * For fine-grained control, pass a [Timeout] object.
+ */
+ fun timeout(timeout: Duration) = apply { clientOptions.timeout(timeout) }
+
+ /**
+ * The maximum number of times to retry failed requests, with a short exponential backoff
+ * between requests.
+ *
+ * Only the following error types are retried:
+ * - Connection errors (for example, due to a network connectivity problem)
+ * - 408 Request Timeout
+ * - 409 Conflict
+ * - 429 Rate Limit
+ * - 5xx Internal
+ *
+ * The API may also explicitly instruct the SDK to retry or not retry a request.
+ *
+ * Defaults to 2.
+ */
+ fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
+
+ fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) }
+
+ /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */
+ fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull())
+
+ fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) }
+
+ /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */
+ fun clientId(clientId: Optional) = clientId(clientId.getOrNull())
+
+ fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) }
+
+ /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */
+ fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull())
+
+ fun webhookSecret(webhookSecret: String?) = apply {
+ clientOptions.webhookSecret(webhookSecret)
+ }
+
+ /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */
+ fun webhookSecret(webhookSecret: Optional) =
+ webhookSecret(webhookSecret.getOrNull())
+
fun headers(headers: Headers) = apply { clientOptions.headers(headers) }
fun headers(headers: Map>) = apply {
@@ -134,51 +297,11 @@ class FinchOkHttpClientAsync private constructor() {
clientOptions.removeAllQueryParams(keys)
}
- fun timeout(timeout: Timeout) = apply {
- clientOptions.timeout(timeout)
- this.timeout = timeout
- }
-
/**
- * Sets the maximum time allowed for a complete HTTP call, not including retries.
+ * Updates configuration using system properties and environment variables.
*
- * See [Timeout.request] for more details.
- *
- * For fine-grained control, pass a [Timeout] object.
+ * @see ClientOptions.Builder.fromEnv
*/
- fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
-
- fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) }
-
- fun proxy(proxy: Proxy) = apply { this.proxy = proxy }
-
- fun responseValidation(responseValidation: Boolean) = apply {
- clientOptions.responseValidation(responseValidation)
- }
-
- fun accessToken(accessToken: String?) = apply { clientOptions.accessToken(accessToken) }
-
- /** Alias for calling [Builder.accessToken] with `accessToken.orElse(null)`. */
- fun accessToken(accessToken: Optional) = accessToken(accessToken.getOrNull())
-
- fun clientId(clientId: String?) = apply { clientOptions.clientId(clientId) }
-
- /** Alias for calling [Builder.clientId] with `clientId.orElse(null)`. */
- fun clientId(clientId: Optional) = clientId(clientId.getOrNull())
-
- fun clientSecret(clientSecret: String?) = apply { clientOptions.clientSecret(clientSecret) }
-
- /** Alias for calling [Builder.clientSecret] with `clientSecret.orElse(null)`. */
- fun clientSecret(clientSecret: Optional) = clientSecret(clientSecret.getOrNull())
-
- fun webhookSecret(webhookSecret: String?) = apply {
- clientOptions.webhookSecret(webhookSecret)
- }
-
- /** Alias for calling [Builder.webhookSecret] with `webhookSecret.orElse(null)`. */
- fun webhookSecret(webhookSecret: Optional) =
- webhookSecret(webhookSecret.getOrNull())
-
fun fromEnv() = apply { clientOptions.fromEnv() }
/**
@@ -189,7 +312,15 @@ class FinchOkHttpClientAsync private constructor() {
fun build(): FinchClientAsync =
FinchClientAsyncImpl(
clientOptions
- .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
+ .httpClient(
+ OkHttpClient.builder()
+ .timeout(clientOptions.timeout())
+ .proxy(proxy)
+ .sslSocketFactory(sslSocketFactory)
+ .trustManager(trustManager)
+ .hostnameVerifier(hostnameVerifier)
+ .build()
+ )
.build()
)
}
diff --git a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt
index 9d66fadb..4480cd8f 100644
--- a/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt
+++ b/finch-java-client-okhttp/src/main/kotlin/com/tryfinch/api/client/okhttp/OkHttpClient.kt
@@ -14,6 +14,9 @@ import java.io.InputStream
import java.net.Proxy
import java.time.Duration
import java.util.concurrent.CompletableFuture
+import javax.net.ssl.HostnameVerifier
+import javax.net.ssl.SSLSocketFactory
+import javax.net.ssl.X509TrustManager
import okhttp3.Call
import okhttp3.Callback
import okhttp3.HttpUrl.Companion.toHttpUrl
@@ -189,6 +192,9 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
+ private var sslSocketFactory: SSLSocketFactory? = null
+ private var trustManager: X509TrustManager? = null
+ private var hostnameVerifier: HostnameVerifier? = null
fun timeout(timeout: Timeout) = apply { this.timeout = timeout }
@@ -196,6 +202,18 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+ fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply {
+ this.sslSocketFactory = sslSocketFactory
+ }
+
+ fun trustManager(trustManager: X509TrustManager?) = apply {
+ this.trustManager = trustManager
+ }
+
+ fun hostnameVerifier(hostnameVerifier: HostnameVerifier?) = apply {
+ this.hostnameVerifier = hostnameVerifier
+ }
+
fun build(): OkHttpClient =
OkHttpClient(
okhttp3.OkHttpClient.Builder()
@@ -204,6 +222,19 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
.writeTimeout(timeout.write())
.callTimeout(timeout.request())
.proxy(proxy)
+ .apply {
+ val sslSocketFactory = sslSocketFactory
+ val trustManager = trustManager
+ if (sslSocketFactory != null && trustManager != null) {
+ sslSocketFactory(sslSocketFactory, trustManager)
+ } else {
+ check((sslSocketFactory != null) == (trustManager != null)) {
+ "Both or none of `sslSocketFactory` and `trustManager` must be set, but only one was set"
+ }
+ }
+
+ hostnameVerifier?.let(::hostnameVerifier)
+ }
.build()
.apply {
// We usually make all our requests to the same host so it makes sense to
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 5f8e59fb..a26bbdbb 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
@@ -4,13 +4,13 @@ package com.tryfinch.api.client
import com.fasterxml.jackson.annotation.JsonProperty
import com.tryfinch.api.core.ClientOptions
-import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.getPackageVersion
+import com.tryfinch.api.core.handlers.errorBodyHandler
import com.tryfinch.api.core.handlers.errorHandler
import com.tryfinch.api.core.handlers.jsonHandler
-import com.tryfinch.api.core.handlers.withErrorHandler
import com.tryfinch.api.core.http.HttpMethod
import com.tryfinch.api.core.http.HttpRequest
+import com.tryfinch.api.core.http.HttpResponse
import com.tryfinch.api.core.http.HttpResponse.Handler
import com.tryfinch.api.core.http.json
import com.tryfinch.api.errors.FinchException
@@ -41,7 +41,8 @@ import java.util.function.Consumer
class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClientAsync {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
@@ -94,7 +95,7 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie
}
private val getAccessTokenHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun sync(): FinchClient = sync
@@ -150,7 +151,7 @@ class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClie
)
.build()
return clientOptions.httpClient.executeAsync(request).thenApply {
- getAccessTokenHandler.handle(it).accessToken
+ getAccessTokenHandler.handle(errorHandler.handle(it)).accessToken
}
}
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 efa56805..b0d6cd0e 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
@@ -4,13 +4,13 @@ package com.tryfinch.api.client
import com.fasterxml.jackson.annotation.JsonProperty
import com.tryfinch.api.core.ClientOptions
-import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.getPackageVersion
+import com.tryfinch.api.core.handlers.errorBodyHandler
import com.tryfinch.api.core.handlers.errorHandler
import com.tryfinch.api.core.handlers.jsonHandler
-import com.tryfinch.api.core.handlers.withErrorHandler
import com.tryfinch.api.core.http.HttpMethod
import com.tryfinch.api.core.http.HttpRequest
+import com.tryfinch.api.core.http.HttpResponse
import com.tryfinch.api.core.http.HttpResponse.Handler
import com.tryfinch.api.core.http.json
import com.tryfinch.api.errors.FinchException
@@ -40,7 +40,8 @@ import java.util.function.Consumer
class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
@@ -83,7 +84,7 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient {
private val connect: ConnectService by lazy { ConnectServiceImpl(clientOptionsWithUserAgent) }
private val getAccessTokenHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun async(): FinchClientAsync = async
@@ -139,7 +140,7 @@ class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient {
)
.build()
return clientOptions.httpClient.execute(request).let {
- getAccessTokenHandler.handle(it).accessToken
+ getAccessTokenHandler.handle(errorHandler.handle(it)).accessToken
}
}
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 e63f1d29..4412cdc0 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
@@ -3,12 +3,14 @@
package com.tryfinch.api.core
import com.fasterxml.jackson.databind.json.JsonMapper
+import com.tryfinch.api.core.http.AsyncStreamResponse
import com.tryfinch.api.core.http.Headers
import com.tryfinch.api.core.http.HttpClient
import com.tryfinch.api.core.http.PhantomReachableClosingHttpClient
import com.tryfinch.api.core.http.QueryParams
import com.tryfinch.api.core.http.RetryingHttpClient
import java.time.Clock
+import java.time.Duration
import java.util.Base64
import java.util.Optional
import java.util.concurrent.Executor
@@ -17,19 +19,79 @@ import java.util.concurrent.ThreadFactory
import java.util.concurrent.atomic.AtomicLong
import kotlin.jvm.optionals.getOrNull
+/** A class representing the SDK client configuration. */
class ClientOptions
private constructor(
private val originalHttpClient: HttpClient,
+ /**
+ * The HTTP client to use in the SDK.
+ *
+ * Use the one published in `finch-java-client-okhttp` or implement your own.
+ */
@get:JvmName("httpClient") val httpClient: HttpClient,
+ /**
+ * Whether to throw an exception if any of the Jackson versions detected at runtime are
+ * incompatible with the SDK's minimum supported Jackson version (2.13.4).
+ *
+ * Defaults to true. Use extreme caution when disabling this option. There is no guarantee that
+ * the SDK will work correctly when using an incompatible Jackson version.
+ */
@get:JvmName("checkJacksonVersionCompatibility") val checkJacksonVersionCompatibility: Boolean,
+ /**
+ * The Jackson JSON mapper to use for serializing and deserializing JSON.
+ *
+ * Defaults to [com.tryfinch.api.core.jsonMapper]. The default is usually sufficient and rarely
+ * needs to be overridden.
+ */
@get:JvmName("jsonMapper") val jsonMapper: JsonMapper,
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ */
@get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor,
+ /**
+ * The clock to use for operations that require timing, like retries.
+ *
+ * This is primarily useful for using a fake clock in tests.
+ *
+ * Defaults to [Clock.systemUTC].
+ */
@get:JvmName("clock") val clock: Clock,
private val baseUrl: String?,
+ /** Headers to send with the request. */
@get:JvmName("headers") val headers: Headers,
+ /** Query params to send with the request. */
@get:JvmName("queryParams") val queryParams: QueryParams,
+ /**
+ * Whether to call `validate` on every response before returning it.
+ *
+ * Defaults to false, which means the shape of the response will not be validated upfront.
+ * Instead, validation will only occur for the parts of the response that are accessed.
+ */
@get:JvmName("responseValidation") val responseValidation: Boolean,
+ /**
+ * Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding
+ * retries.
+ *
+ * Defaults to [Timeout.default].
+ */
@get:JvmName("timeout") val timeout: Timeout,
+ /**
+ * The maximum number of times to retry failed requests, with a short exponential backoff
+ * between requests.
+ *
+ * Only the following error types are retried:
+ * - Connection errors (for example, due to a network connectivity problem)
+ * - 408 Request Timeout
+ * - 409 Conflict
+ * - 429 Rate Limit
+ * - 5xx Internal
+ *
+ * The API may also explicitly instruct the SDK to retry or not retry a request.
+ *
+ * Defaults to 2.
+ */
@get:JvmName("maxRetries") val maxRetries: Int,
private val accessToken: String?,
private val clientId: String?,
@@ -43,6 +105,11 @@ private constructor(
}
}
+ /**
+ * The base URL to use for every request.
+ *
+ * Defaults to the production environment: `https://api.tryfinch.com`.
+ */
fun baseUrl(): String = baseUrl ?: PRODUCTION_URL
fun accessToken(): Optional = Optional.ofNullable(accessToken)
@@ -69,6 +136,11 @@ private constructor(
*/
@JvmStatic fun builder() = Builder()
+ /**
+ * Returns options configured using system properties and environment variables.
+ *
+ * @see Builder.fromEnv
+ */
@JvmStatic fun fromEnv(): ClientOptions = builder().fromEnv().build()
}
@@ -110,33 +182,104 @@ private constructor(
webhookSecret = clientOptions.webhookSecret
}
+ /**
+ * The HTTP client to use in the SDK.
+ *
+ * Use the one published in `finch-java-client-okhttp` or implement your own.
+ */
fun httpClient(httpClient: HttpClient) = apply {
this.httpClient = PhantomReachableClosingHttpClient(httpClient)
}
+ /**
+ * Whether to throw an exception if any of the Jackson versions detected at runtime are
+ * incompatible with the SDK's minimum supported Jackson version (2.13.4).
+ *
+ * Defaults to true. Use extreme caution when disabling this option. There is no guarantee
+ * that the SDK will work correctly when using an incompatible Jackson version.
+ */
fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply {
this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility
}
+ /**
+ * The Jackson JSON mapper to use for serializing and deserializing JSON.
+ *
+ * Defaults to [com.tryfinch.api.core.jsonMapper]. The default is usually sufficient and
+ * rarely needs to be overridden.
+ */
fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper }
+ /**
+ * The executor to use for running [AsyncStreamResponse.Handler] callbacks.
+ *
+ * Defaults to a dedicated cached thread pool.
+ */
fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
this.streamHandlerExecutor = streamHandlerExecutor
}
+ /**
+ * The clock to use for operations that require timing, like retries.
+ *
+ * This is primarily useful for using a fake clock in tests.
+ *
+ * Defaults to [Clock.systemUTC].
+ */
fun clock(clock: Clock) = apply { this.clock = clock }
+ /**
+ * The base URL to use for every request.
+ *
+ * Defaults to the production environment: `https://api.tryfinch.com`.
+ */
fun baseUrl(baseUrl: String?) = apply { this.baseUrl = baseUrl }
/** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull())
+ /**
+ * Whether to call `validate` on every response before returning it.
+ *
+ * Defaults to false, which means the shape of the response will not be validated upfront.
+ * Instead, validation will only occur for the parts of the response that are accessed.
+ */
fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
}
+ /**
+ * Sets the maximum time allowed for various parts of an HTTP call's lifecycle, excluding
+ * retries.
+ *
+ * Defaults to [Timeout.default].
+ */
fun timeout(timeout: Timeout) = apply { this.timeout = timeout }
+ /**
+ * Sets the maximum time allowed for a complete HTTP call, not including retries.
+ *
+ * See [Timeout.request] for more details.
+ *
+ * For fine-grained control, pass a [Timeout] object.
+ */
+ fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
+
+ /**
+ * The maximum number of times to retry failed requests, with a short exponential backoff
+ * between requests.
+ *
+ * Only the following error types are retried:
+ * - Connection errors (for example, due to a network connectivity problem)
+ * - 408 Request Timeout
+ * - 409 Conflict
+ * - 429 Rate Limit
+ * - 5xx Internal
+ *
+ * The API may also explicitly instruct the SDK to retry or not retry a request.
+ *
+ * Defaults to 2.
+ */
fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries }
fun accessToken(accessToken: String?) = apply { this.accessToken = accessToken }
@@ -240,11 +383,33 @@ private constructor(
fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) }
+ fun timeout(): Timeout = timeout
+
+ /**
+ * Updates configuration using system properties and environment variables.
+ *
+ * See this table for the available options:
+ *
+ * |Setter |System property |Environment variable |Required|Default value |
+ * |---------------|---------------------|----------------------|--------|----------------------------|
+ * |`clientId` |`finch.clientId` |`FINCH_CLIENT_ID` |false |- |
+ * |`clientSecret` |`finch.clientSecret` |`FINCH_CLIENT_SECRET` |false |- |
+ * |`webhookSecret`|`finch.webhookSecret`|`FINCH_WEBHOOK_SECRET`|false |- |
+ * |`baseUrl` |`finch.baseUrl` |`FINCH_BASE_URL` |true |`"https://api.tryfinch.com"`|
+ *
+ * System properties take precedence over environment variables.
+ */
fun fromEnv() = apply {
- System.getenv("FINCH_BASE_URL")?.let { baseUrl(it) }
- System.getenv("FINCH_CLIENT_ID")?.let { clientId(it) }
- System.getenv("FINCH_CLIENT_SECRET")?.let { clientSecret(it) }
- System.getenv("FINCH_WEBHOOK_SECRET")?.let { webhookSecret(it) }
+ (System.getProperty("finch.baseUrl") ?: System.getenv("FINCH_BASE_URL"))?.let {
+ baseUrl(it)
+ }
+ (System.getProperty("finch.clientId") ?: System.getenv("FINCH_CLIENT_ID"))?.let {
+ clientId(it)
+ }
+ (System.getProperty("finch.clientSecret") ?: System.getenv("FINCH_CLIENT_SECRET"))
+ ?.let { clientSecret(it) }
+ (System.getProperty("finch.webhookSecret") ?: System.getenv("FINCH_WEBHOOK_SECRET"))
+ ?.let { webhookSecret(it) }
}
/**
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt
index 578e8a45..884fa16c 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/handlers/ErrorHandler.kt
@@ -19,7 +19,7 @@ import com.tryfinch.api.errors.UnexpectedStatusCodeException
import com.tryfinch.api.errors.UnprocessableEntityException
@JvmSynthetic
-internal fun errorHandler(jsonMapper: JsonMapper): Handler {
+internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler {
val handler = jsonHandler(jsonMapper)
return object : Handler {
@@ -33,52 +33,52 @@ internal fun errorHandler(jsonMapper: JsonMapper): Handler {
}
@JvmSynthetic
-internal fun Handler.withErrorHandler(errorHandler: Handler): Handler =
- object : Handler {
- override fun handle(response: HttpResponse): T =
+internal fun errorHandler(errorBodyHandler: Handler): Handler =
+ object : Handler {
+ override fun handle(response: HttpResponse): HttpResponse =
when (val statusCode = response.statusCode()) {
- in 200..299 -> this@withErrorHandler.handle(response)
+ in 200..299 -> response
400 ->
throw BadRequestException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
401 ->
throw UnauthorizedException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
403 ->
throw PermissionDeniedException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
404 ->
throw NotFoundException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
422 ->
throw UnprocessableEntityException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
429 ->
throw RateLimitException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
in 500..599 ->
throw InternalServerException.builder()
.statusCode(statusCode)
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
else ->
throw UnexpectedStatusCodeException.builder()
.statusCode(statusCode)
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
}
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/Headers.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/Headers.kt
index b3b56dec..fa541fd4 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/Headers.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/Headers.kt
@@ -1,5 +1,15 @@
+// File generated from our OpenAPI spec by Stainless.
+
package com.tryfinch.api.core.http
+import com.tryfinch.api.core.JsonArray
+import com.tryfinch.api.core.JsonBoolean
+import com.tryfinch.api.core.JsonMissing
+import com.tryfinch.api.core.JsonNull
+import com.tryfinch.api.core.JsonNumber
+import com.tryfinch.api.core.JsonObject
+import com.tryfinch.api.core.JsonString
+import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.toImmutable
import java.util.TreeMap
@@ -28,6 +38,19 @@ private constructor(
TreeMap(String.CASE_INSENSITIVE_ORDER)
private var size: Int = 0
+ fun put(name: String, value: JsonValue): Builder = apply {
+ when (value) {
+ is JsonMissing,
+ is JsonNull -> {}
+ is JsonBoolean -> put(name, value.value.toString())
+ is JsonNumber -> put(name, value.value.toString())
+ is JsonString -> put(name, value.value)
+ is JsonArray -> value.values.forEach { put(name, it) }
+ is JsonObject ->
+ value.values.forEach { (nestedName, value) -> put("$name.$nestedName", value) }
+ }
+ }
+
fun put(name: String, value: String) = apply {
map.getOrPut(name) { mutableListOf() }.add(value)
size++
@@ -41,15 +64,6 @@ private constructor(
headers.names().forEach { put(it, headers.values(it)) }
}
- fun remove(name: String) = apply { size -= map.remove(name).orEmpty().size }
-
- fun removeAll(names: Set) = apply { names.forEach(::remove) }
-
- fun clear() = apply {
- map.clear()
- size = 0
- }
-
fun replace(name: String, value: String) = apply {
remove(name)
put(name, value)
@@ -68,6 +82,15 @@ private constructor(
headers.names().forEach { replace(it, headers.values(it)) }
}
+ fun remove(name: String) = apply { size -= map.remove(name).orEmpty().size }
+
+ fun removeAll(names: Set) = apply { names.forEach(::remove) }
+
+ fun clear() = apply {
+ map.clear()
+ size = 0
+ }
+
fun build() =
Headers(
map.mapValuesTo(TreeMap(String.CASE_INSENSITIVE_ORDER)) { (_, values) ->
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt
index 9d2ff7c5..dd845b98 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/QueryParams.kt
@@ -2,6 +2,14 @@
package com.tryfinch.api.core.http
+import com.tryfinch.api.core.JsonArray
+import com.tryfinch.api.core.JsonBoolean
+import com.tryfinch.api.core.JsonMissing
+import com.tryfinch.api.core.JsonNull
+import com.tryfinch.api.core.JsonNumber
+import com.tryfinch.api.core.JsonObject
+import com.tryfinch.api.core.JsonString
+import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.toImmutable
class QueryParams
@@ -28,6 +36,19 @@ private constructor(
private val map: MutableMap> = mutableMapOf()
private var size: Int = 0
+ fun put(key: String, value: JsonValue): Builder = apply {
+ when (value) {
+ is JsonMissing,
+ is JsonNull -> {}
+ is JsonBoolean -> put(key, value.value.toString())
+ is JsonNumber -> put(key, value.value.toString())
+ is JsonString -> put(key, value.value)
+ is JsonArray -> value.values.forEach { put("$key[]", it) }
+ is JsonObject ->
+ value.values.forEach { (nestedKey, value) -> put("$key[$nestedKey]", value) }
+ }
+ }
+
fun put(key: String, value: String) = apply {
map.getOrPut(key) { mutableListOf() }.add(value)
size++
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 6a89eec0..05e11284 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
@@ -81,8 +81,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
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 20b1623d..72e823e6 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
@@ -18,10 +18,13 @@ private constructor(
private val additionalBodyProperties: Map,
) : Params {
+ /** Additional body properties to send with the request. */
fun _additionalBodyProperties(): Map = additionalBodyProperties
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt
index 946ad406..c79e5862 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountIntrospectParams.kt
@@ -14,8 +14,10 @@ private constructor(
private val additionalQueryParams: QueryParams,
) : Params {
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt
index 35b96448..a4273f99 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedCreateResponse.kt
@@ -14,13 +14,15 @@ import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.errors.FinchInvalidDataException
import java.util.Collections
import java.util.Objects
+import java.util.Optional
class AutomatedCreateResponse
private constructor(
private val allowedRefreshes: JsonField,
+ private val remainingRefreshes: JsonField,
private val jobId: JsonField,
private val jobUrl: JsonField,
- private val remainingRefreshes: JsonField,
+ private val retryAt: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -29,12 +31,13 @@ private constructor(
@JsonProperty("allowed_refreshes")
@ExcludeMissing
allowedRefreshes: JsonField = JsonMissing.of(),
- @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(),
- @JsonProperty("job_url") @ExcludeMissing jobUrl: JsonField = JsonMissing.of(),
@JsonProperty("remaining_refreshes")
@ExcludeMissing
remainingRefreshes: JsonField = JsonMissing.of(),
- ) : this(allowedRefreshes, jobId, jobUrl, remainingRefreshes, mutableMapOf())
+ @JsonProperty("job_id") @ExcludeMissing jobId: JsonField = JsonMissing.of(),
+ @JsonProperty("job_url") @ExcludeMissing jobUrl: JsonField = JsonMissing.of(),
+ @JsonProperty("retry_at") @ExcludeMissing retryAt: JsonField = JsonMissing.of(),
+ ) : this(allowedRefreshes, remainingRefreshes, jobId, jobUrl, retryAt, mutableMapOf())
/**
* The number of allowed refreshes per hour (per hour, fixed window)
@@ -45,28 +48,36 @@ private constructor(
fun allowedRefreshes(): Long = allowedRefreshes.getRequired("allowed_refreshes")
/**
- * The id of the job that has been created.
+ * The number of remaining refreshes available (per hour, fixed window)
*
* @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
* missing or null (e.g. if the server responded with an unexpected value).
*/
- fun jobId(): String = jobId.getRequired("job_id")
+ fun remainingRefreshes(): Long = remainingRefreshes.getRequired("remaining_refreshes")
+
+ /**
+ * The id of the job that has been created.
+ *
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun jobId(): Optional = jobId.getOptional("job_id")
/**
* The url that can be used to retrieve the job status
*
- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
- * missing or null (e.g. if the server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
*/
- fun jobUrl(): String = jobUrl.getRequired("job_url")
+ fun jobUrl(): Optional = jobUrl.getOptional("job_url")
/**
- * The number of remaining refreshes available (per hour, fixed window)
+ * ISO 8601 timestamp indicating when to retry the request
*
- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
- * missing or null (e.g. if the server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
*/
- fun remainingRefreshes(): Long = remainingRefreshes.getRequired("remaining_refreshes")
+ fun retryAt(): Optional = retryAt.getOptional("retry_at")
/**
* Returns the raw JSON value of [allowedRefreshes].
@@ -78,6 +89,16 @@ private constructor(
@ExcludeMissing
fun _allowedRefreshes(): JsonField = allowedRefreshes
+ /**
+ * Returns the raw JSON value of [remainingRefreshes].
+ *
+ * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("remaining_refreshes")
+ @ExcludeMissing
+ fun _remainingRefreshes(): JsonField = remainingRefreshes
+
/**
* Returns the raw JSON value of [jobId].
*
@@ -93,14 +114,11 @@ private constructor(
@JsonProperty("job_url") @ExcludeMissing fun _jobUrl(): JsonField = jobUrl
/**
- * Returns the raw JSON value of [remainingRefreshes].
+ * Returns the raw JSON value of [retryAt].
*
- * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an unexpected
- * type.
+ * Unlike [retryAt], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("remaining_refreshes")
- @ExcludeMissing
- fun _remainingRefreshes(): JsonField = remainingRefreshes
+ @JsonProperty("retry_at") @ExcludeMissing fun _retryAt(): JsonField = retryAt
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
@@ -122,8 +140,6 @@ private constructor(
* The following fields are required:
* ```java
* .allowedRefreshes()
- * .jobId()
- * .jobUrl()
* .remainingRefreshes()
* ```
*/
@@ -134,17 +150,19 @@ private constructor(
class Builder internal constructor() {
private var allowedRefreshes: JsonField? = null
- private var jobId: JsonField? = null
- private var jobUrl: JsonField? = null
private var remainingRefreshes: JsonField? = null
+ private var jobId: JsonField = JsonMissing.of()
+ private var jobUrl: JsonField = JsonMissing.of()
+ private var retryAt: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(automatedCreateResponse: AutomatedCreateResponse) = apply {
allowedRefreshes = automatedCreateResponse.allowedRefreshes
+ remainingRefreshes = automatedCreateResponse.remainingRefreshes
jobId = automatedCreateResponse.jobId
jobUrl = automatedCreateResponse.jobUrl
- remainingRefreshes = automatedCreateResponse.remainingRefreshes
+ retryAt = automatedCreateResponse.retryAt
additionalProperties = automatedCreateResponse.additionalProperties.toMutableMap()
}
@@ -163,6 +181,21 @@ private constructor(
this.allowedRefreshes = allowedRefreshes
}
+ /** The number of remaining refreshes available (per hour, fixed window) */
+ fun remainingRefreshes(remainingRefreshes: Long) =
+ remainingRefreshes(JsonField.of(remainingRefreshes))
+
+ /**
+ * Sets [Builder.remainingRefreshes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun remainingRefreshes(remainingRefreshes: JsonField) = apply {
+ this.remainingRefreshes = remainingRefreshes
+ }
+
/** The id of the job that has been created. */
fun jobId(jobId: String) = jobId(JsonField.of(jobId))
@@ -185,20 +218,16 @@ private constructor(
*/
fun jobUrl(jobUrl: JsonField) = apply { this.jobUrl = jobUrl }
- /** The number of remaining refreshes available (per hour, fixed window) */
- fun remainingRefreshes(remainingRefreshes: Long) =
- remainingRefreshes(JsonField.of(remainingRefreshes))
+ /** ISO 8601 timestamp indicating when to retry the request */
+ fun retryAt(retryAt: String) = retryAt(JsonField.of(retryAt))
/**
- * Sets [Builder.remainingRefreshes] to an arbitrary JSON value.
+ * Sets [Builder.retryAt] to an arbitrary JSON value.
*
- * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
+ * You should usually call [Builder.retryAt] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
*/
- fun remainingRefreshes(remainingRefreshes: JsonField) = apply {
- this.remainingRefreshes = remainingRefreshes
- }
+ fun retryAt(retryAt: JsonField) = apply { this.retryAt = retryAt }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -227,8 +256,6 @@ private constructor(
* The following fields are required:
* ```java
* .allowedRefreshes()
- * .jobId()
- * .jobUrl()
* .remainingRefreshes()
* ```
*
@@ -237,9 +264,10 @@ private constructor(
fun build(): AutomatedCreateResponse =
AutomatedCreateResponse(
checkRequired("allowedRefreshes", allowedRefreshes),
- checkRequired("jobId", jobId),
- checkRequired("jobUrl", jobUrl),
checkRequired("remainingRefreshes", remainingRefreshes),
+ jobId,
+ jobUrl,
+ retryAt,
additionalProperties.toMutableMap(),
)
}
@@ -252,9 +280,10 @@ private constructor(
}
allowedRefreshes()
+ remainingRefreshes()
jobId()
jobUrl()
- remainingRefreshes()
+ retryAt()
validated = true
}
@@ -274,24 +303,25 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (allowedRefreshes.asKnown().isPresent) 1 else 0) +
+ (if (remainingRefreshes.asKnown().isPresent) 1 else 0) +
(if (jobId.asKnown().isPresent) 1 else 0) +
(if (jobUrl.asKnown().isPresent) 1 else 0) +
- (if (remainingRefreshes.asKnown().isPresent) 1 else 0)
+ (if (retryAt.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
- return /* spotless:off */ other is AutomatedCreateResponse && allowedRefreshes == other.allowedRefreshes && jobId == other.jobId && jobUrl == other.jobUrl && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is AutomatedCreateResponse && allowedRefreshes == other.allowedRefreshes && remainingRefreshes == other.remainingRefreshes && jobId == other.jobId && jobUrl == other.jobUrl && retryAt == other.retryAt && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(allowedRefreshes, jobId, jobUrl, remainingRefreshes, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(allowedRefreshes, remainingRefreshes, jobId, jobUrl, retryAt, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "AutomatedCreateResponse{allowedRefreshes=$allowedRefreshes, jobId=$jobId, jobUrl=$jobUrl, remainingRefreshes=$remainingRefreshes, additionalProperties=$additionalProperties}"
+ "AutomatedCreateResponse{allowedRefreshes=$allowedRefreshes, remainingRefreshes=$remainingRefreshes, jobId=$jobId, jobUrl=$jobUrl, retryAt=$retryAt, additionalProperties=$additionalProperties}"
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt
index 7c842ee6..9d1e4808 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitContribution.kt
@@ -11,6 +11,7 @@ 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.checkRequired
import com.tryfinch.api.errors.FinchInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -74,15 +75,23 @@ private constructor(
companion object {
- /** Returns a mutable builder for constructing an instance of [BenefitContribution]. */
+ /**
+ * Returns a mutable builder for constructing an instance of [BenefitContribution].
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .type()
+ * ```
+ */
@JvmStatic fun builder() = Builder()
}
/** A builder for [BenefitContribution]. */
class Builder internal constructor() {
- private var amount: JsonField = JsonMissing.of()
- private var type: JsonField = JsonMissing.of()
+ private var amount: JsonField? = null
+ private var type: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -150,9 +159,21 @@ private constructor(
* Returns an immutable instance of [BenefitContribution].
*
* Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
*/
fun build(): BenefitContribution =
- BenefitContribution(amount, type, additionalProperties.toMutableMap())
+ BenefitContribution(
+ checkRequired("amount", amount),
+ checkRequired("type", type),
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt
index 0d37a391..fcb26d32 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFrequency.kt
@@ -22,20 +22,20 @@ class BenefitFrequency @JsonCreator private constructor(private val value: JsonF
companion object {
- @JvmField val ONE_TIME = of("one_time")
-
@JvmField val EVERY_PAYCHECK = of("every_paycheck")
@JvmField val MONTHLY = of("monthly")
+ @JvmField val ONE_TIME = of("one_time")
+
@JvmStatic fun of(value: String) = BenefitFrequency(JsonField.of(value))
}
/** An enum containing [BenefitFrequency]'s known values. */
enum class Known {
- ONE_TIME,
EVERY_PAYCHECK,
MONTHLY,
+ ONE_TIME,
}
/**
@@ -48,9 +48,9 @@ class BenefitFrequency @JsonCreator private constructor(private val value: JsonF
* - It was constructed with an arbitrary value using the [of] method.
*/
enum class Value {
- ONE_TIME,
EVERY_PAYCHECK,
MONTHLY,
+ ONE_TIME,
/**
* An enum member indicating that [BenefitFrequency] was instantiated with an unknown value.
*/
@@ -66,9 +66,9 @@ class BenefitFrequency @JsonCreator private constructor(private val value: JsonF
*/
fun value(): Value =
when (this) {
- ONE_TIME -> Value.ONE_TIME
EVERY_PAYCHECK -> Value.EVERY_PAYCHECK
MONTHLY -> Value.MONTHLY
+ ONE_TIME -> Value.ONE_TIME
else -> Value._UNKNOWN
}
@@ -82,9 +82,9 @@ class BenefitFrequency @JsonCreator private constructor(private val value: JsonF
*/
fun known(): Known =
when (this) {
- ONE_TIME -> Known.ONE_TIME
EVERY_PAYCHECK -> Known.EVERY_PAYCHECK
MONTHLY -> Known.MONTHLY
+ ONE_TIME -> Known.ONE_TIME
else -> throw FinchInvalidDataException("Unknown BenefitFrequency: $value")
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt
index 2ece80bf..d9abb755 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyBenefit.kt
@@ -23,19 +23,16 @@ import kotlin.jvm.optionals.getOrNull
class CompanyBenefit
private constructor(
private val benefitId: JsonField,
- private val companyContribution: JsonField,
private val description: JsonField,
private val frequency: JsonField,
private val type: JsonField,
+ private val companyContribution: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
@JsonProperty("benefit_id") @ExcludeMissing benefitId: JsonField = JsonMissing.of(),
- @JsonProperty("company_contribution")
- @ExcludeMissing
- companyContribution: JsonField = JsonMissing.of(),
@JsonProperty("description")
@ExcludeMissing
description: JsonField = JsonMissing.of(),
@@ -43,7 +40,10 @@ private constructor(
@ExcludeMissing
frequency: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
- ) : this(benefitId, companyContribution, description, frequency, type, mutableMapOf())
+ @JsonProperty("company_contribution")
+ @ExcludeMissing
+ companyContribution: JsonField = JsonMissing.of(),
+ ) : this(benefitId, description, frequency, type, companyContribution, mutableMapOf())
/**
* The id of the benefit.
@@ -53,15 +53,6 @@ private constructor(
*/
fun benefitId(): String = benefitId.getRequired("benefit_id")
- /**
- * The company match for this benefit.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun companyContribution(): Optional =
- companyContribution.getOptional("company_contribution")
-
/**
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -85,21 +76,20 @@ private constructor(
fun type(): Optional = type.getOptional("type")
/**
- * Returns the raw JSON value of [benefitId].
+ * The company match for this benefit.
*
- * Unlike [benefitId], this method doesn't throw if the JSON field has an unexpected type.
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
*/
- @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId
+ fun companyContribution(): Optional =
+ companyContribution.getOptional("company_contribution")
/**
- * Returns the raw JSON value of [companyContribution].
+ * Returns the raw JSON value of [benefitId].
*
- * Unlike [companyContribution], this method doesn't throw if the JSON field has an unexpected
- * type.
+ * Unlike [benefitId], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("company_contribution")
- @ExcludeMissing
- fun _companyContribution(): JsonField = companyContribution
+ @JsonProperty("benefit_id") @ExcludeMissing fun _benefitId(): JsonField = benefitId
/**
* Returns the raw JSON value of [description].
@@ -124,6 +114,16 @@ private constructor(
*/
@JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+ /**
+ * Returns the raw JSON value of [companyContribution].
+ *
+ * Unlike [companyContribution], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("company_contribution")
+ @ExcludeMissing
+ fun _companyContribution(): JsonField = companyContribution
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -144,7 +144,6 @@ private constructor(
* The following fields are required:
* ```java
* .benefitId()
- * .companyContribution()
* .description()
* .frequency()
* .type()
@@ -157,19 +156,20 @@ private constructor(
class Builder internal constructor() {
private var benefitId: JsonField? = null
- private var companyContribution: JsonField? = null
private var description: JsonField? = null
private var frequency: JsonField? = null
private var type: JsonField? = null
+ private var companyContribution: JsonField =
+ JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(companyBenefit: CompanyBenefit) = apply {
benefitId = companyBenefit.benefitId
- companyContribution = companyBenefit.companyContribution
description = companyBenefit.description
frequency = companyBenefit.frequency
type = companyBenefit.type
+ companyContribution = companyBenefit.companyContribution
additionalProperties = companyBenefit.additionalProperties.toMutableMap()
}
@@ -185,28 +185,6 @@ private constructor(
*/
fun benefitId(benefitId: JsonField) = apply { this.benefitId = benefitId }
- /** The company match for this benefit. */
- fun companyContribution(companyContribution: BenefitCompanyMatchContribution?) =
- companyContribution(JsonField.ofNullable(companyContribution))
-
- /**
- * Alias for calling [Builder.companyContribution] with `companyContribution.orElse(null)`.
- */
- fun companyContribution(companyContribution: Optional) =
- companyContribution(companyContribution.getOrNull())
-
- /**
- * Sets [Builder.companyContribution] to an arbitrary JSON value.
- *
- * You should usually call [Builder.companyContribution] with a well-typed
- * [BenefitCompanyMatchContribution] value instead. This method is primarily for setting the
- * field to an undocumented or not yet supported value.
- */
- fun companyContribution(companyContribution: JsonField) =
- apply {
- this.companyContribution = companyContribution
- }
-
fun description(description: String?) = description(JsonField.ofNullable(description))
/** Alias for calling [Builder.description] with `description.orElse(null)`. */
@@ -251,6 +229,28 @@ private constructor(
*/
fun type(type: JsonField) = apply { this.type = type }
+ /** The company match for this benefit. */
+ fun companyContribution(companyContribution: BenefitCompanyMatchContribution?) =
+ companyContribution(JsonField.ofNullable(companyContribution))
+
+ /**
+ * Alias for calling [Builder.companyContribution] with `companyContribution.orElse(null)`.
+ */
+ fun companyContribution(companyContribution: Optional) =
+ companyContribution(companyContribution.getOrNull())
+
+ /**
+ * Sets [Builder.companyContribution] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.companyContribution] with a well-typed
+ * [BenefitCompanyMatchContribution] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun companyContribution(companyContribution: JsonField) =
+ apply {
+ this.companyContribution = companyContribution
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -278,7 +278,6 @@ private constructor(
* The following fields are required:
* ```java
* .benefitId()
- * .companyContribution()
* .description()
* .frequency()
* .type()
@@ -289,10 +288,10 @@ private constructor(
fun build(): CompanyBenefit =
CompanyBenefit(
checkRequired("benefitId", benefitId),
- checkRequired("companyContribution", companyContribution),
checkRequired("description", description),
checkRequired("frequency", frequency),
checkRequired("type", type),
+ companyContribution,
additionalProperties.toMutableMap(),
)
}
@@ -305,10 +304,10 @@ private constructor(
}
benefitId()
- companyContribution().ifPresent { it.validate() }
description()
frequency().ifPresent { it.validate() }
type().ifPresent { it.validate() }
+ companyContribution().ifPresent { it.validate() }
validated = true
}
@@ -328,10 +327,10 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (benefitId.asKnown().isPresent) 1 else 0) +
- (companyContribution.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(frequency.asKnown().getOrNull()?.validity() ?: 0) +
- (type.asKnown().getOrNull()?.validity() ?: 0)
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (companyContribution.asKnown().getOrNull()?.validity() ?: 0)
/** The company match for this benefit. */
class BenefitCompanyMatchContribution
@@ -348,16 +347,16 @@ private constructor(
) : this(tiers, type, mutableMapOf())
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
*/
- fun tiers(): Optional> = tiers.getOptional("tiers")
+ fun tiers(): List = tiers.getRequired("tiers")
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
*/
- fun type(): Optional = type.getOptional("type")
+ fun type(): Type = type.getRequired("type")
/**
* Returns the raw JSON value of [tiers].
@@ -390,6 +389,12 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
* [BenefitCompanyMatchContribution].
+ *
+ * The following fields are required:
+ * ```java
+ * .tiers()
+ * .type()
+ * ```
*/
@JvmStatic fun builder() = Builder()
}
@@ -398,7 +403,7 @@ private constructor(
class Builder internal constructor() {
private var tiers: JsonField>? = null
- private var type: JsonField = JsonMissing.of()
+ private var type: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -469,11 +474,19 @@ private constructor(
* Returns an immutable instance of [BenefitCompanyMatchContribution].
*
* Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .tiers()
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
*/
fun build(): BenefitCompanyMatchContribution =
BenefitCompanyMatchContribution(
- (tiers ?: JsonMissing.of()).map { it.toImmutable() },
- type,
+ checkRequired("tiers", tiers).map { it.toImmutable() },
+ checkRequired("type", type),
additionalProperties.toMutableMap(),
)
}
@@ -485,8 +498,8 @@ private constructor(
return@apply
}
- tiers().ifPresent { it.forEach { it.validate() } }
- type().ifPresent { it.validate() }
+ tiers().forEach { it.validate() }
+ type().validate()
validated = true
}
@@ -525,16 +538,18 @@ private constructor(
) : this(match, threshold, mutableMapOf())
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
*/
- fun match(): Optional = match.getOptional("match")
+ fun match(): Long = match.getRequired("match")
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
*/
- fun threshold(): Optional = threshold.getOptional("threshold")
+ fun threshold(): Long = threshold.getRequired("threshold")
/**
* Returns the raw JSON value of [match].
@@ -565,15 +580,23 @@ private constructor(
companion object {
- /** Returns a mutable builder for constructing an instance of [Tier]. */
+ /**
+ * Returns a mutable builder for constructing an instance of [Tier].
+ *
+ * The following fields are required:
+ * ```java
+ * .match()
+ * .threshold()
+ * ```
+ */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Tier]. */
class Builder internal constructor() {
- private var match: JsonField = JsonMissing.of()
- private var threshold: JsonField = JsonMissing.of()
+ private var match: JsonField? = null
+ private var threshold: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -631,8 +654,21 @@ private constructor(
* Returns an immutable instance of [Tier].
*
* Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .match()
+ * .threshold()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
*/
- fun build(): Tier = Tier(match, threshold, additionalProperties.toMutableMap())
+ fun build(): Tier =
+ Tier(
+ checkRequired("match", match),
+ checkRequired("threshold", threshold),
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
@@ -828,15 +864,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is CompanyBenefit && benefitId == other.benefitId && companyContribution == other.companyContribution && description == other.description && frequency == other.frequency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is CompanyBenefit && benefitId == other.benefitId && description == other.description && frequency == other.frequency && type == other.type && companyContribution == other.companyContribution && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(benefitId, companyContribution, description, frequency, type, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(benefitId, description, frequency, type, companyContribution, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "CompanyBenefit{benefitId=$benefitId, companyContribution=$companyContribution, description=$description, frequency=$frequency, type=$type, additionalProperties=$additionalProperties}"
+ "CompanyBenefit{benefitId=$benefitId, description=$description, frequency=$frequency, type=$type, companyContribution=$companyContribution, additionalProperties=$additionalProperties}"
}
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt
index a2c22053..4f01e4c2 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionNewParams.kt
@@ -152,8 +152,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt
index ebd35f98..f005460b 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParams.kt
@@ -93,8 +93,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt
index e95ca383..7c349292 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentData.kt
@@ -2513,7 +2513,8 @@ private constructor(
@JvmStatic fun ofString(string: String) = Value(string = string)
@JvmStatic
- fun ofJsonValues(jsonValues: List) = Value(jsonValues = jsonValues)
+ fun ofJsonValues(jsonValues: List) =
+ Value(jsonValues = jsonValues.toImmutable())
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt
index 80d41eaa..6cfe2de0 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitCreateParams.kt
@@ -13,6 +13,7 @@ import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.Params
import com.tryfinch.api.core.checkKnown
+import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.core.http.Headers
import com.tryfinch.api.core.http.QueryParams
import com.tryfinch.api.core.toImmutable
@@ -99,8 +100,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
@@ -647,16 +650,16 @@ private constructor(
) : this(tiers, type, mutableMapOf())
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
*/
- fun tiers(): Optional> = tiers.getOptional("tiers")
+ fun tiers(): List = tiers.getRequired("tiers")
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
*/
- fun type(): Optional = type.getOptional("type")
+ fun type(): Type = type.getRequired("type")
/**
* Returns the raw JSON value of [tiers].
@@ -689,6 +692,12 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
* [BenefitCompanyMatchContribution].
+ *
+ * The following fields are required:
+ * ```java
+ * .tiers()
+ * .type()
+ * ```
*/
@JvmStatic fun builder() = Builder()
}
@@ -697,7 +706,7 @@ private constructor(
class Builder internal constructor() {
private var tiers: JsonField>? = null
- private var type: JsonField = JsonMissing.of()
+ private var type: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -768,11 +777,19 @@ private constructor(
* Returns an immutable instance of [BenefitCompanyMatchContribution].
*
* Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .tiers()
+ * .type()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
*/
fun build(): BenefitCompanyMatchContribution =
BenefitCompanyMatchContribution(
- (tiers ?: JsonMissing.of()).map { it.toImmutable() },
- type,
+ checkRequired("tiers", tiers).map { it.toImmutable() },
+ checkRequired("type", type),
additionalProperties.toMutableMap(),
)
}
@@ -784,8 +801,8 @@ private constructor(
return@apply
}
- tiers().ifPresent { it.forEach { it.validate() } }
- type().ifPresent { it.validate() }
+ tiers().forEach { it.validate() }
+ type().validate()
validated = true
}
@@ -824,16 +841,18 @@ private constructor(
) : this(match, threshold, mutableMapOf())
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
*/
- fun match(): Optional = match.getOptional("match")
+ fun match(): Long = match.getRequired("match")
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
*/
- fun threshold(): Optional = threshold.getOptional("threshold")
+ fun threshold(): Long = threshold.getRequired("threshold")
/**
* Returns the raw JSON value of [match].
@@ -864,15 +883,23 @@ private constructor(
companion object {
- /** Returns a mutable builder for constructing an instance of [Tier]. */
+ /**
+ * Returns a mutable builder for constructing an instance of [Tier].
+ *
+ * The following fields are required:
+ * ```java
+ * .match()
+ * .threshold()
+ * ```
+ */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Tier]. */
class Builder internal constructor() {
- private var match: JsonField = JsonMissing.of()
- private var threshold: JsonField = JsonMissing.of()
+ private var match: JsonField? = null
+ private var threshold: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -930,8 +957,21 @@ private constructor(
* Returns an immutable instance of [Tier].
*
* Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .match()
+ * .threshold()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
*/
- fun build(): Tier = Tier(match, threshold, additionalProperties.toMutableMap())
+ fun build(): Tier =
+ Tier(
+ checkRequired("match", match),
+ checkRequired("threshold", threshold),
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt
index bdd47916..34df79fc 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualEnrolledIdsParams.kt
@@ -19,8 +19,10 @@ private constructor(
fun benefitId(): Optional = Optional.ofNullable(benefitId)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt
index 672d1d92..44ca77e0 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt
@@ -8,7 +8,7 @@ import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.blocking.hris.benefits.IndividualService
import java.util.Objects
-/** @see [IndividualService.retrieveManyBenefits] */
+/** @see IndividualService.retrieveManyBenefits */
class HrisBenefitIndividualRetrieveManyBenefitsPage
private constructor(
private val service: IndividualService,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt
index 22b85713..2b5a04c4 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt
@@ -10,7 +10,7 @@ import java.util.Objects
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
-/** @see [IndividualServiceAsync.retrieveManyBenefits] */
+/** @see IndividualServiceAsync.retrieveManyBenefits */
class HrisBenefitIndividualRetrieveManyBenefitsPageAsync
private constructor(
private val service: IndividualServiceAsync,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt
index 7c6e196e..56d0e06b 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParams.kt
@@ -26,8 +26,10 @@ private constructor(
*/
fun individualIds(): Optional = Optional.ofNullable(individualIds)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt
index 45431317..7a191a78 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParams.kt
@@ -49,8 +49,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt
index 09ca0633..5a17a714 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt
@@ -8,7 +8,7 @@ import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.blocking.hris.BenefitService
import java.util.Objects
-/** @see [BenefitService.list] */
+/** @see BenefitService.list */
class HrisBenefitListPage
private constructor(
private val service: BenefitService,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt
index 884830d5..57b1e4dd 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt
@@ -10,7 +10,7 @@ import java.util.Objects
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
-/** @see [BenefitServiceAsync.list] */
+/** @see BenefitServiceAsync.list */
class HrisBenefitListPageAsync
private constructor(
private val service: BenefitServiceAsync,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt
index daaa4c63..97aebd76 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListParams.kt
@@ -14,8 +14,10 @@ private constructor(
private val additionalQueryParams: QueryParams,
) : Params {
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt
index 15f3d0c8..9bd03f24 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt
@@ -10,7 +10,7 @@ import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
-/** @see [BenefitService.listSupportedBenefits] */
+/** @see BenefitService.listSupportedBenefits */
class HrisBenefitListSupportedBenefitsPage
private constructor(
private val service: BenefitService,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt
index cdbc03ea..91b3d1f4 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt
@@ -12,7 +12,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrNull
-/** @see [BenefitServiceAsync.listSupportedBenefits] */
+/** @see BenefitServiceAsync.listSupportedBenefits */
class HrisBenefitListSupportedBenefitsPageAsync
private constructor(
private val service: BenefitServiceAsync,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt
index df408510..1987b178 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsParams.kt
@@ -14,8 +14,10 @@ private constructor(
private val additionalQueryParams: QueryParams,
) : Params {
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt
index c6fa8c33..620b4343 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitRetrieveParams.kt
@@ -19,8 +19,10 @@ private constructor(
fun benefitId(): Optional = Optional.ofNullable(benefitId)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt
index 90b691f3..f9341f0c 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParams.kt
@@ -47,8 +47,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt
index 38a27d53..ba87ea50 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt
@@ -9,7 +9,7 @@ import com.tryfinch.api.services.blocking.hris.company.PayStatementItemService
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
-/** @see [PayStatementItemService.list] */
+/** @see PayStatementItemService.list */
class HrisCompanyPayStatementItemListPage
private constructor(
private val service: PayStatementItemService,
@@ -21,7 +21,7 @@ private constructor(
* Delegates to [HrisCompanyPayStatementItemListPageResponse], but gracefully handles missing
* data.
*
- * @see [HrisCompanyPayStatementItemListPageResponse.responses]
+ * @see HrisCompanyPayStatementItemListPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt
index 9ad7c8d2..2c583048 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt
@@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrNull
-/** @see [PayStatementItemServiceAsync.list] */
+/** @see PayStatementItemServiceAsync.list */
class HrisCompanyPayStatementItemListPageAsync
private constructor(
private val service: PayStatementItemServiceAsync,
@@ -24,7 +24,7 @@ private constructor(
* Delegates to [HrisCompanyPayStatementItemListPageResponse], but gracefully handles missing
* data.
*
- * @see [HrisCompanyPayStatementItemListPageResponse.responses]
+ * @see HrisCompanyPayStatementItemListPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt
index 5c38f85d..72693bb0 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListParams.kt
@@ -55,8 +55,10 @@ private constructor(
/** String search by pay statement item type. */
fun type(): Optional = Optional.ofNullable(type)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt
index 62891454..89f27eb5 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleCreateParams.kt
@@ -113,8 +113,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt
index 1f47cbe2..f52d38c6 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleDeleteParams.kt
@@ -25,10 +25,13 @@ private constructor(
fun ruleId(): Optional = Optional.ofNullable(ruleId)
+ /** Additional body properties to send with the request. */
fun _additionalBodyProperties(): Map = additionalBodyProperties
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt
index 6e23fe25..355f0037 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt
@@ -9,7 +9,7 @@ import com.tryfinch.api.services.blocking.hris.company.payStatementItem.RuleServ
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
-/** @see [RuleService.list] */
+/** @see RuleService.list */
class HrisCompanyPayStatementItemRuleListPage
private constructor(
private val service: RuleService,
@@ -21,7 +21,7 @@ private constructor(
* Delegates to [HrisCompanyPayStatementItemRuleListPageResponse], but gracefully handles
* missing data.
*
- * @see [HrisCompanyPayStatementItemRuleListPageResponse.responses]
+ * @see HrisCompanyPayStatementItemRuleListPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt
index 623b1a8a..34df071f 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt
@@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrNull
-/** @see [RuleServiceAsync.list] */
+/** @see RuleServiceAsync.list */
class HrisCompanyPayStatementItemRuleListPageAsync
private constructor(
private val service: RuleServiceAsync,
@@ -24,7 +24,7 @@ private constructor(
* Delegates to [HrisCompanyPayStatementItemRuleListPageResponse], but gracefully handles
* missing data.
*
- * @see [HrisCompanyPayStatementItemRuleListPageResponse.responses]
+ * @see HrisCompanyPayStatementItemRuleListPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt
index a958f121..64806711 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListParams.kt
@@ -17,8 +17,10 @@ private constructor(
private val additionalQueryParams: QueryParams,
) : Params {
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt
index e509e8bf..aea721df 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleUpdateParams.kt
@@ -36,8 +36,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt
index ddb27057..87d63be6 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyRetrieveParams.kt
@@ -14,8 +14,10 @@ private constructor(
private val additionalQueryParams: QueryParams,
) : Params {
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt
index 8f3c042a..70ed0f14 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt
@@ -11,7 +11,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrDefault
import kotlin.jvm.optionals.getOrNull
-/** @see [DirectoryService.listIndividuals] */
+/** @see DirectoryService.listIndividuals */
@Deprecated("use `list` instead")
class HrisDirectoryListIndividualsPage
private constructor(
@@ -23,7 +23,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListIndividualsPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListIndividualsPageResponse.individuals]
+ * @see HrisDirectoryListIndividualsPageResponse.individuals
*/
fun individuals(): List =
response._individuals().getOptional("individuals").getOrNull() ?: emptyList()
@@ -31,7 +31,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListIndividualsPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListIndividualsPageResponse.paging]
+ * @see HrisDirectoryListIndividualsPageResponse.paging
*/
fun paging(): Optional = response._paging().getOptional("paging")
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt
index 1a20863f..ab1f2804 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt
@@ -13,7 +13,7 @@ import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrDefault
import kotlin.jvm.optionals.getOrNull
-/** @see [DirectoryServiceAsync.listIndividuals] */
+/** @see DirectoryServiceAsync.listIndividuals */
@Deprecated("use `list` instead")
class HrisDirectoryListIndividualsPageAsync
private constructor(
@@ -26,7 +26,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListIndividualsPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListIndividualsPageResponse.individuals]
+ * @see HrisDirectoryListIndividualsPageResponse.individuals
*/
fun individuals(): List =
response._individuals().getOptional("individuals").getOrNull() ?: emptyList()
@@ -34,7 +34,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListIndividualsPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListIndividualsPageResponse.paging]
+ * @see HrisDirectoryListIndividualsPageResponse.paging
*/
fun paging(): Optional = response._paging().getOptional("paging")
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt
index 6975371d..b324bc6e 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt
@@ -25,8 +25,10 @@ private constructor(
/** Index to start from (defaults to 0) */
fun offset(): Optional = Optional.ofNullable(offset)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt
index f30e6e3c..978d43ec 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt
@@ -11,7 +11,7 @@ import java.util.Optional
import kotlin.jvm.optionals.getOrDefault
import kotlin.jvm.optionals.getOrNull
-/** @see [DirectoryService.list] */
+/** @see DirectoryService.list */
class HrisDirectoryListPage
private constructor(
private val service: DirectoryService,
@@ -22,7 +22,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListPageResponse.individuals]
+ * @see HrisDirectoryListPageResponse.individuals
*/
fun individuals(): List =
response._individuals().getOptional("individuals").getOrNull() ?: emptyList()
@@ -30,7 +30,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListPageResponse.paging]
+ * @see HrisDirectoryListPageResponse.paging
*/
fun paging(): Optional = response._paging().getOptional("paging")
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt
index 06b6ee3a..057fc609 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt
@@ -13,7 +13,7 @@ import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrDefault
import kotlin.jvm.optionals.getOrNull
-/** @see [DirectoryServiceAsync.list] */
+/** @see DirectoryServiceAsync.list */
class HrisDirectoryListPageAsync
private constructor(
private val service: DirectoryServiceAsync,
@@ -25,7 +25,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListPageResponse.individuals]
+ * @see HrisDirectoryListPageResponse.individuals
*/
fun individuals(): List =
response._individuals().getOptional("individuals").getOrNull() ?: emptyList()
@@ -33,7 +33,7 @@ private constructor(
/**
* Delegates to [HrisDirectoryListPageResponse], but gracefully handles missing data.
*
- * @see [HrisDirectoryListPageResponse.paging]
+ * @see HrisDirectoryListPageResponse.paging
*/
fun paging(): Optional = response._paging().getOptional("paging")
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt
index be838dc8..365a5ed2 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt
@@ -24,8 +24,10 @@ private constructor(
/** Index to start from (defaults to 0) */
fun offset(): Optional = Optional.ofNullable(offset)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt
index dd322628..2dd65346 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt
@@ -40,8 +40,10 @@ private constructor(
/** Comma-delimited list of document types to filter on. If empty, defaults to all types */
fun types(): Optional> = Optional.ofNullable(types)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt
index c0d046d1..8647208e 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt
@@ -22,8 +22,10 @@ private constructor(
fun documentId(): Optional = Optional.ofNullable(documentId)
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt
index ac8306aa..b54ca1aa 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt
@@ -9,7 +9,7 @@ import com.tryfinch.api.services.blocking.hris.EmploymentService
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
-/** @see [EmploymentService.retrieveMany] */
+/** @see EmploymentService.retrieveMany */
class HrisEmploymentRetrieveManyPage
private constructor(
private val service: EmploymentService,
@@ -20,7 +20,7 @@ private constructor(
/**
* Delegates to [HrisEmploymentRetrieveManyPageResponse], but gracefully handles missing data.
*
- * @see [HrisEmploymentRetrieveManyPageResponse.responses]
+ * @see HrisEmploymentRetrieveManyPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt
index f00e98c9..53f537b2 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt
@@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrNull
-/** @see [EmploymentServiceAsync.retrieveMany] */
+/** @see EmploymentServiceAsync.retrieveMany */
class HrisEmploymentRetrieveManyPageAsync
private constructor(
private val service: EmploymentServiceAsync,
@@ -23,7 +23,7 @@ private constructor(
/**
* Delegates to [HrisEmploymentRetrieveManyPageResponse], but gracefully handles missing data.
*
- * @see [HrisEmploymentRetrieveManyPageResponse.responses]
+ * @see HrisEmploymentRetrieveManyPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt
index 869a198d..8723ad66 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt
@@ -46,8 +46,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt
index 19d656c2..639f4619 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt
@@ -9,7 +9,7 @@ import com.tryfinch.api.services.blocking.hris.IndividualService
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
-/** @see [IndividualService.retrieveMany] */
+/** @see IndividualService.retrieveMany */
class HrisIndividualRetrieveManyPage
private constructor(
private val service: IndividualService,
@@ -20,7 +20,7 @@ private constructor(
/**
* Delegates to [HrisIndividualRetrieveManyPageResponse], but gracefully handles missing data.
*
- * @see [HrisIndividualRetrieveManyPageResponse.responses]
+ * @see HrisIndividualRetrieveManyPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt
index c9a0aeb5..5f67dc8c 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt
@@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrNull
-/** @see [IndividualServiceAsync.retrieveMany] */
+/** @see IndividualServiceAsync.retrieveMany */
class HrisIndividualRetrieveManyPageAsync
private constructor(
private val service: IndividualServiceAsync,
@@ -23,7 +23,7 @@ private constructor(
/**
* Delegates to [HrisIndividualRetrieveManyPageResponse], but gracefully handles missing data.
*
- * @see [HrisIndividualRetrieveManyPageResponse.responses]
+ * @see HrisIndividualRetrieveManyPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt
index 6a0cedfb..9f29d452 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt
@@ -57,8 +57,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt
index 09c3d3b8..8c6f2f95 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt
@@ -9,7 +9,7 @@ import com.tryfinch.api.services.blocking.hris.PayStatementService
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
-/** @see [PayStatementService.retrieveMany] */
+/** @see PayStatementService.retrieveMany */
class HrisPayStatementRetrieveManyPage
private constructor(
private val service: PayStatementService,
@@ -20,7 +20,7 @@ private constructor(
/**
* Delegates to [HrisPayStatementRetrieveManyPageResponse], but gracefully handles missing data.
*
- * @see [HrisPayStatementRetrieveManyPageResponse.responses]
+ * @see HrisPayStatementRetrieveManyPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt
index df55d75d..f8168cfc 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt
@@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
import kotlin.jvm.optionals.getOrNull
-/** @see [PayStatementServiceAsync.retrieveMany] */
+/** @see PayStatementServiceAsync.retrieveMany */
class HrisPayStatementRetrieveManyPageAsync
private constructor(
private val service: PayStatementServiceAsync,
@@ -23,7 +23,7 @@ private constructor(
/**
* Delegates to [HrisPayStatementRetrieveManyPageResponse], but gracefully handles missing data.
*
- * @see [HrisPayStatementRetrieveManyPageResponse.responses]
+ * @see HrisPayStatementRetrieveManyPageResponse.responses
*/
fun responses(): List =
response._responses().getOptional("responses").getOrNull() ?: emptyList()
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt
index 62779262..0ce7f943 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt
@@ -51,8 +51,10 @@ private constructor(
fun _additionalBodyProperties(): Map = body._additionalProperties()
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt
index 66eef149..4592ed53 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt
@@ -8,7 +8,7 @@ import com.tryfinch.api.core.checkRequired
import com.tryfinch.api.services.blocking.hris.PaymentService
import java.util.Objects
-/** @see [PaymentService.list] */
+/** @see PaymentService.list */
class HrisPaymentListPage
private constructor(
private val service: PaymentService,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt
index e5164328..0ec58e97 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt
@@ -10,7 +10,7 @@ import java.util.Objects
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Executor
-/** @see [PaymentServiceAsync.list] */
+/** @see PaymentServiceAsync.list */
class HrisPaymentListPageAsync
private constructor(
private val service: PaymentServiceAsync,
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt
index 918a4ba6..e331e044 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListParams.kt
@@ -24,8 +24,10 @@ private constructor(
/** The start date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format. */
fun startDate(): LocalDate = startDate
+ /** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
+ /** Additional query param to send with the request. */
fun _additionalQueryParams(): QueryParams = additionalQueryParams
fun toBuilder() = Builder().from(this)
diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt
index c42a1109..5254cd90 100644
--- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt
+++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualBenefit.kt
@@ -6,11 +6,23 @@ 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.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.tryfinch.api.core.BaseDeserializer
+import com.tryfinch.api.core.BaseSerializer
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.allMaxBy
+import com.tryfinch.api.core.checkRequired
+import com.tryfinch.api.core.getOrThrow
import com.tryfinch.api.errors.FinchInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -35,22 +47,22 @@ private constructor(
) : this(body, code, individualId, mutableMapOf())
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
+ * missing or null (e.g. if the server responded with an unexpected value).
*/
- fun body(): Optional = body.getOptional("body")
+ fun body(): Body = body.getRequired("body")
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
+ * missing or null (e.g. if the server responded with an unexpected value).
*/
- fun code(): Optional = code.getOptional("code")
+ fun code(): Long = code.getRequired("code")
/**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
+ * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
+ * missing or null (e.g. if the server responded with an unexpected value).
*/
- fun individualId(): Optional = individualId.getOptional("individual_id")
+ fun individualId(): String = individualId.getRequired("individual_id")
/**
* Returns the raw JSON value of [body].
@@ -89,16 +101,25 @@ private constructor(
companion object {
- /** Returns a mutable builder for constructing an instance of [IndividualBenefit]. */
+ /**
+ * Returns a mutable builder for constructing an instance of [IndividualBenefit].
+ *
+ * The following fields are required:
+ * ```java
+ * .body()
+ * .code()
+ * .individualId()
+ * ```
+ */
@JvmStatic fun builder() = Builder()
}
/** A builder for [IndividualBenefit]. */
class Builder internal constructor() {
- private var body: JsonField = JsonMissing.of()
- private var code: JsonField = JsonMissing.of()
- private var individualId: JsonField = JsonMissing.of()
+ private var body: JsonField? = null
+ private var code: JsonField? = null
+ private var individualId: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -119,6 +140,12 @@ private constructor(
*/
fun body(body: JsonField) = apply { this.body = body }
+ /** Alias for calling [body] with `Body.ofUnionMember0(unionMember0)`. */
+ fun body(unionMember0: Body.UnionMember0) = body(Body.ofUnionMember0(unionMember0))
+
+ /** Alias for calling [body] with `Body.ofBatchError(batchError)`. */
+ fun body(batchError: Body.BatchError) = body(Body.ofBatchError(batchError))
+
fun code(code: Long) = code(JsonField.of(code))
/**
@@ -165,9 +192,23 @@ private constructor(
* Returns an immutable instance of [IndividualBenefit].
*
* Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .body()
+ * .code()
+ * .individualId()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
*/
fun build(): IndividualBenefit =
- IndividualBenefit(body, code, individualId, additionalProperties.toMutableMap())
+ IndividualBenefit(
+ checkRequired("body", body),
+ checkRequired("code", code),
+ checkRequired("individualId", individualId),
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
@@ -177,7 +218,7 @@ private constructor(
return@apply
}
- body().ifPresent { it.validate() }
+ body().validate()
code()
individualId()
validated = true
@@ -202,457 +243,931 @@ private constructor(
(if (code.asKnown().isPresent) 1 else 0) +
(if (individualId.asKnown().isPresent) 1 else 0)
+ @JsonDeserialize(using = Body.Deserializer::class)
+ @JsonSerialize(using = Body.Serializer::class)
class Body
private constructor(
- private val annualMaximum: JsonField,
- private val catchUp: JsonField,
- private val companyContribution: JsonField,
- private val employeeDeduction: JsonField,
- private val hsaContributionLimit: JsonField,
- private val additionalProperties: MutableMap,
+ private val unionMember0: UnionMember0? = null,
+ private val batchError: BatchError? = null,
+ private val _json: JsonValue? = null,
) {
- @JsonCreator
- private constructor(
- @JsonProperty("annual_maximum")
- @ExcludeMissing
- annualMaximum: JsonField = JsonMissing.of(),
- @JsonProperty("catch_up")
- @ExcludeMissing
- catchUp: JsonField = JsonMissing.of(),
- @JsonProperty("company_contribution")
- @ExcludeMissing
- companyContribution: JsonField = JsonMissing.of(),
- @JsonProperty("employee_deduction")
- @ExcludeMissing
- employeeDeduction: JsonField = JsonMissing.of(),
- @JsonProperty("hsa_contribution_limit")
- @ExcludeMissing
- hsaContributionLimit: JsonField = JsonMissing.of(),
- ) : this(
- annualMaximum,
- catchUp,
- companyContribution,
- employeeDeduction,
- hsaContributionLimit,
- mutableMapOf(),
- )
+ fun unionMember0(): Optional = Optional.ofNullable(unionMember0)
- /**
- * If the benefit supports annual maximum, the amount in cents for this individual.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun annualMaximum(): Optional = annualMaximum.getOptional("annual_maximum")
+ fun batchError(): Optional = Optional.ofNullable(batchError)
- /**
- * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled for this
- * individual.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun catchUp(): Optional = catchUp.getOptional("catch_up")
+ fun isUnionMember0(): Boolean = unionMember0 != null
- /**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun companyContribution(): Optional =
- companyContribution.getOptional("company_contribution")
+ fun isBatchError(): Boolean = batchError != null
- /**
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun employeeDeduction(): Optional =
- employeeDeduction.getOptional("employee_deduction")
+ fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
- /**
- * Type for HSA contribution limit if the benefit is a HSA.
- *
- * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun hsaContributionLimit(): Optional =
- hsaContributionLimit.getOptional("hsa_contribution_limit")
+ fun asBatchError(): BatchError = batchError.getOrThrow("batchError")
- /**
- * Returns the raw JSON value of [annualMaximum].
- *
- * Unlike [annualMaximum], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("annual_maximum")
- @ExcludeMissing
- fun _annualMaximum(): JsonField = annualMaximum
+ fun _json(): Optional = Optional.ofNullable(_json)
- /**
- * Returns the raw JSON value of [catchUp].
- *
- * Unlike [catchUp], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("catch_up") @ExcludeMissing fun _catchUp(): JsonField = catchUp
+ fun accept(visitor: Visitor): T =
+ when {
+ unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
+ batchError != null -> visitor.visitBatchError(batchError)
+ else -> visitor.unknown(_json)
+ }
- /**
- * Returns the raw JSON value of [companyContribution].
- *
- * Unlike [companyContribution], this method doesn't throw if the JSON field has an
- * unexpected type.
- */
- @JsonProperty("company_contribution")
- @ExcludeMissing
- fun _companyContribution(): JsonField = companyContribution
+ private var validated: Boolean = false
- /**
- * Returns the raw JSON value of [employeeDeduction].
- *
- * Unlike [employeeDeduction], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("employee_deduction")
- @ExcludeMissing
- fun _employeeDeduction(): JsonField = employeeDeduction
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitUnionMember0(unionMember0: UnionMember0) {
+ unionMember0.validate()
+ }
+
+ override fun visitBatchError(batchError: BatchError) {
+ batchError.validate()
+ }
+ }
+ )
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: FinchInvalidDataException) {
+ false
+ }
/**
- * Returns the raw JSON value of [hsaContributionLimit].
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
*
- * Unlike [hsaContributionLimit], this method doesn't throw if the JSON field has an
- * unexpected type.
+ * Used for best match union deserialization.
*/
- @JsonProperty("hsa_contribution_limit")
- @ExcludeMissing
- fun _hsaContributionLimit(): JsonField = hsaContributionLimit
+ @JvmSynthetic
+ internal fun validity(): Int =
+ accept(
+ object : Visitor {
+ override fun visitUnionMember0(unionMember0: UnionMember0) =
+ unionMember0.validity()
- @JsonAnySetter
- private fun putAdditionalProperty(key: String, value: JsonValue) {
- additionalProperties.put(key, value)
+ override fun visitBatchError(batchError: BatchError) = batchError.validity()
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Body && unionMember0 == other.unionMember0 && batchError == other.batchError /* spotless:on */
}
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map =
- Collections.unmodifiableMap(additionalProperties)
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(unionMember0, batchError) /* spotless:on */
- fun toBuilder() = Builder().from(this)
+ override fun toString(): String =
+ when {
+ unionMember0 != null -> "Body{unionMember0=$unionMember0}"
+ batchError != null -> "Body{batchError=$batchError}"
+ _json != null -> "Body{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Body")
+ }
companion object {
- /** Returns a mutable builder for constructing an instance of [Body]. */
- @JvmStatic fun builder() = Builder()
- }
+ @JvmStatic
+ fun ofUnionMember0(unionMember0: UnionMember0) = Body(unionMember0 = unionMember0)
- /** A builder for [Body]. */
- class Builder internal constructor() {
+ @JvmStatic fun ofBatchError(batchError: BatchError) = Body(batchError = batchError)
+ }
- private var annualMaximum: JsonField = JsonMissing.of()
- private var catchUp: JsonField = JsonMissing.of()
- private var companyContribution: JsonField = JsonMissing.of()
- private var employeeDeduction: JsonField = JsonMissing.of()
- private var hsaContributionLimit: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
+ /** An interface that defines how to map each variant of [Body] to a value of type [T]. */
+ interface Visitor {
- @JvmSynthetic
- internal fun from(body: Body) = apply {
- annualMaximum = body.annualMaximum
- catchUp = body.catchUp
- companyContribution = body.companyContribution
- employeeDeduction = body.employeeDeduction
- hsaContributionLimit = body.hsaContributionLimit
- additionalProperties = body.additionalProperties.toMutableMap()
- }
+ fun visitUnionMember0(unionMember0: UnionMember0): T
- /** If the benefit supports annual maximum, the amount in cents for this individual. */
- fun annualMaximum(annualMaximum: Long?) =
- annualMaximum(JsonField.ofNullable(annualMaximum))
+ fun visitBatchError(batchError: BatchError): T
/**
- * Alias for [Builder.annualMaximum].
+ * Maps an unknown variant of [Body] to a value of type [T].
*
- * This unboxed primitive overload exists for backwards compatibility.
+ * An instance of [Body] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws FinchInvalidDataException in the default implementation.
*/
- fun annualMaximum(annualMaximum: Long) = annualMaximum(annualMaximum as Long?)
+ fun unknown(json: JsonValue?): T {
+ throw FinchInvalidDataException("Unknown Body: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Body::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Body {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Body(unionMember0 = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Body(batchError = it, _json = json)
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with
+ // all the possible variants (e.g. deserializing from boolean).
+ 0 -> Body(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely
+ // valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Body::class) {
+
+ override fun serialize(
+ value: Body,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.unionMember0 != null -> generator.writeObject(value.unionMember0)
+ value.batchError != null -> generator.writeObject(value.batchError)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Body")
+ }
+ }
+ }
- /** Alias for calling [Builder.annualMaximum] with `annualMaximum.orElse(null)`. */
- fun annualMaximum(annualMaximum: Optional) =
- annualMaximum(annualMaximum.getOrNull())
+ class UnionMember0
+ private constructor(
+ private val annualMaximum: JsonField,
+ private val catchUp: JsonField,
+ private val companyContribution: JsonField,
+ private val employeeDeduction: JsonField,
+ private val hsaContributionLimit: JsonField,
+ private val additionalProperties: MutableMap