diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71594a4c..121ace97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Validate Gradle wrapper - uses: gradle/actions/wrapper-validation@v3 - - name: Set up Java uses: actions/setup-java@v4 with: @@ -30,7 +27,7 @@ jobs: cache: gradle - name: Set up Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v4 - name: Run lints run: ./scripts/lint diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 51b15c88..3b4c2d4b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.0.2" + ".": "4.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 119fd722..23dfdad6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-97bf4795deec23d1bfd3b0b5fd77c2a93c87f10e5fa3375ab30f4a877be97f53.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-5d2b3a9cdbcfb6f10b6e621ef7ababbd2701316e5ea1117ced072ab76bdbec34.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 04de6b78..9fe07907 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # Changelog +## 4.1.0 (2025-02-25) + +Full Changelog: [v4.0.2...v4.1.0](https://github.com/Finch-API/finch-api-java/compare/v4.0.2...v4.1.0) + +### Features + +* **api:** api update ([#454](https://github.com/Finch-API/finch-api-java/issues/454)) ([6a36319](https://github.com/Finch-API/finch-api-java/commit/6a3631913bea77b83216b72d47bc96fc9381aaa7)) +* **client:** get rid of annoying checked exceptions ([#449](https://github.com/Finch-API/finch-api-java/issues/449)) ([e7312ce](https://github.com/Finch-API/finch-api-java/commit/e7312ce5f83cad66a8b1c71697dda825c595480b)) +* **client:** support `JsonField#asX()` for known values ([#443](https://github.com/Finch-API/finch-api-java/issues/443)) ([d2c8ddd](https://github.com/Finch-API/finch-api-java/commit/d2c8ddd34286909b0c77b36a931c7784c6031297)) +* **client:** update enum `asX` methods ([#442](https://github.com/Finch-API/finch-api-java/issues/442)) ([caffc54](https://github.com/Finch-API/finch-api-java/commit/caffc542b831856cac7e1be5079b03a112b203f7)) + + +### Bug Fixes + +* **client:** mark some request bodies as optional ([#451](https://github.com/Finch-API/finch-api-java/issues/451)) ([344ac4b](https://github.com/Finch-API/finch-api-java/commit/344ac4bd5a99c29f50c8bf62640e536251fc491d)) +* **internal:** format code ([a34264f](https://github.com/Finch-API/finch-api-java/commit/a34264f4f11d18a8322e289f6505cc119853fc68)) + + +### Chores + +* **ci:** update gradle actions to v4 ([#447](https://github.com/Finch-API/finch-api-java/issues/447)) ([97cc45e](https://github.com/Finch-API/finch-api-java/commit/97cc45e241bf75d7255ba8fc645975168a944b7d)) +* **docs:** add faq to readme ([#450](https://github.com/Finch-API/finch-api-java/issues/450)) ([fd63219](https://github.com/Finch-API/finch-api-java/commit/fd63219b1fe6bda4743f2150cfa1ee4290e271d9)) +* **docs:** reorganize readme ([#444](https://github.com/Finch-API/finch-api-java/issues/444)) ([164050e](https://github.com/Finch-API/finch-api-java/commit/164050e39888c30f3c6f38c8b94f31c356813db5)) +* **internal:** codegen related update ([#448](https://github.com/Finch-API/finch-api-java/issues/448)) ([6db2948](https://github.com/Finch-API/finch-api-java/commit/6db294858870c374b2cb30bf4fd02a52e66452b6)) +* **internal:** get rid of configuration cache ([#446](https://github.com/Finch-API/finch-api-java/issues/446)) ([35edbd8](https://github.com/Finch-API/finch-api-java/commit/35edbd85822b3a521077d9d1ac96d5e071d018a5)) +* **internal:** make body class constructors private ([545758d](https://github.com/Finch-API/finch-api-java/commit/545758da4865c820e81165c78cd9034aa75e0a9b)) +* **internal:** make body classes for multipart requests ([545758d](https://github.com/Finch-API/finch-api-java/commit/545758da4865c820e81165c78cd9034aa75e0a9b)) +* **internal:** misc formatting changes ([545758d](https://github.com/Finch-API/finch-api-java/commit/545758da4865c820e81165c78cd9034aa75e0a9b)) +* **internal:** optimize build and test perf ([54b58c8](https://github.com/Finch-API/finch-api-java/commit/54b58c894270795449f4a4ad42d0bc6ff0448658)) +* **internal:** remove unnecessary non-null asserts in tests ([344ac4b](https://github.com/Finch-API/finch-api-java/commit/344ac4bd5a99c29f50c8bf62640e536251fc491d)) +* **internal:** rename internal body classes ([545758d](https://github.com/Finch-API/finch-api-java/commit/545758da4865c820e81165c78cd9034aa75e0a9b)) +* **internal:** update formatter ([#439](https://github.com/Finch-API/finch-api-java/issues/439)) ([54b58c8](https://github.com/Finch-API/finch-api-java/commit/54b58c894270795449f4a4ad42d0bc6ff0448658)) +* **internal:** update some formatting in `Values.kt` ([d2c8ddd](https://github.com/Finch-API/finch-api-java/commit/d2c8ddd34286909b0c77b36a931c7784c6031297)) +* **internal:** use `assertNotNull` in tests for type narrowing ([344ac4b](https://github.com/Finch-API/finch-api-java/commit/344ac4bd5a99c29f50c8bf62640e536251fc491d)) +* **internal:** use better test example values ([#441](https://github.com/Finch-API/finch-api-java/issues/441)) ([545758d](https://github.com/Finch-API/finch-api-java/commit/545758da4865c820e81165c78cd9034aa75e0a9b)) +* **test:** update some test values ([#437](https://github.com/Finch-API/finch-api-java/issues/437)) ([602f2c0](https://github.com/Finch-API/finch-api-java/commit/602f2c0e0ae1d1351d141faf91e20a3c5e3164eb)) + + +### Documentation + +* add immutability explanation to readme ([#452](https://github.com/Finch-API/finch-api-java/issues/452)) ([8f256fb](https://github.com/Finch-API/finch-api-java/commit/8f256fbfc0f39a56d8f416b5ea03e42c3e422c60)) +* add source file links to readme ([#453](https://github.com/Finch-API/finch-api-java/issues/453)) ([becaa47](https://github.com/Finch-API/finch-api-java/commit/becaa47cb5fb7138518157dfa92410d268fa55fd)) + ## 4.0.2 (2025-02-12) Full Changelog: [v4.0.1...v4.0.2](https://github.com/Finch-API/finch-api-java/compare/v4.0.1...v4.0.2) diff --git a/README.md b/README.md index 12b43fd0..d469a892 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/4.0.2) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/4.1.0) @@ -23,7 +23,7 @@ The REST API documentation can be found [in the Finch Documentation Center](htt ### Gradle ```kotlin -implementation("com.tryfinch.api:finch-java:4.0.2") +implementation("com.tryfinch.api:finch-java:4.1.0") ``` ### Maven @@ -32,7 +32,7 @@ implementation("com.tryfinch.api:finch-java:4.0.2") com.tryfinch.api finch-java - 4.0.2 + 4.1.0 ``` @@ -44,42 +44,17 @@ This library requires Java 8 or later. ## Usage -### Configure the client - -Use `FinchOkHttpClient.builder()` to configure the client. - -Alternately, set the environment with `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` or `FINCH_WEBHOOK_SECRET`, and use `FinchOkHttpClient.fromEnv()` to read from the environment. - ```java import com.tryfinch.api.client.FinchClient; import com.tryfinch.api.client.okhttp.FinchOkHttpClient; +import com.tryfinch.api.models.HrisDirectoryListPage; +import com.tryfinch.api.models.HrisDirectoryListParams; -FinchClient client = FinchOkHttpClient.fromEnv(); - -// Note: you can also call fromEnv() from the client builder, for example if you need to set additional properties FinchClient client = FinchOkHttpClient.builder() + // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables .fromEnv() - // ... set properties on the builder + .accessToken("My Access Token") .build(); -``` - -| Property | Environment variable | Required | Default value | -| ------------- | ---------------------- | -------- | ------------- | -| clientId | `FINCH_CLIENT_ID` | false | — | -| clientSecret | `FINCH_CLIENT_SECRET` | false | — | -| webhookSecret | `FINCH_WEBHOOK_SECRET` | false | — | - -Read the documentation for more configuration options. - ---- - -### Example: creating a resource - -To create a new hris directory, first use the `HrisDirectoryListParams` builder to specify attributes, then pass that to the `list` method of the `directory` service. - -```java -import com.tryfinch.api.models.HrisDirectoryListPage; -import com.tryfinch.api.models.HrisDirectoryListParams; HrisDirectoryListParams params = HrisDirectoryListParams.builder() .candidateId("") @@ -87,100 +62,136 @@ HrisDirectoryListParams params = HrisDirectoryListParams.builder() HrisDirectoryListPage page = client.hris().directory().list(params); ``` -### Example: listing resources +## Client configuration -The Finch API provides a `list` method to get a paginated list of directory. You can retrieve the first page by: +Configure the client using environment variables: ```java -import com.tryfinch.api.models.HrisDirectoryListPage; -import com.tryfinch.api.models.IndividualInDirectory; +import com.tryfinch.api.client.FinchClient; +import com.tryfinch.api.client.okhttp.FinchOkHttpClient; -HrisDirectoryListPage page = client.hris().directory().list(); -for (IndividualInDirectory directory : page.individuals()) { - System.out.println(directory); -} +FinchClient client = FinchOkHttpClient.builder() + // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables + .fromEnv() + .accessToken("My Access Token") + .build(); ``` -Use the `HrisDirectoryListParams` builder to set parameters: +Or manually: ```java -import com.tryfinch.api.models.HrisDirectoryListPage; -import com.tryfinch.api.models.HrisDirectoryListParams; +import com.tryfinch.api.client.FinchClient; +import com.tryfinch.api.client.okhttp.FinchOkHttpClient; -HrisDirectoryListParams params = HrisDirectoryListParams.builder() - .limit(0L) - .offset(0L) +FinchClient client = FinchOkHttpClient.builder() + .accessToken("My Access Token") .build(); -HrisDirectoryListPage page1 = client.hris().directory().list(params); +``` + +Or using a combination of the two approaches: -// Using the `from` method of the builder you can reuse previous params values: -HrisDirectoryListPage page2 = client.hris().directory().list(HrisDirectoryListParams.builder() - .from(params) - .build()); +```java +import com.tryfinch.api.client.FinchClient; +import com.tryfinch.api.client.okhttp.FinchOkHttpClient; -// Or easily get params for the next page by using the helper `getNextPageParams`: -HrisDirectoryListPage page3 = client.hris().directory().list(params.getNextPageParams(page2)); +FinchClient client = FinchOkHttpClient.builder() + // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables + .fromEnv() + .accessToken("My Access Token") + .accessToken("My Access Token") + .build(); ``` -See [Pagination](#pagination) below for more information on transparently working with lists of objects without worrying about fetching each page. +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 | - | -## Requests +> [!TIP] +> Don't create more than one client in the same application. Each client has a connection pool and +> thread pools, which are more efficient to share between requests. -### Parameters and bodies +## Requests and responses -To make a request to the Finch API, you generally build an instance of the appropriate `Params` class. +To send a request to the Finch API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class. -See [Undocumented request params](#undocumented-request-params) for how to send arbitrary parameters. +For example, `client.hris().directory().list(...)` should be called with an instance of `HrisDirectoryListParams`, and it will return an instance of `HrisDirectoryListPage`. -## Responses +## Immutability -### Response validation +Each class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it. -When receiving a response, the Finch Java SDK will deserialize it into instances of the typed model classes. In rare cases, the API may return a response property that doesn't match the expected Java type. If you directly access the mistaken property, the SDK will throw an unchecked `FinchInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model. +Each class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy. + +Because each class is immutable, builder modification will _never_ affect already built class instances. + +## Asynchronous execution + +The default client is synchronous. To switch to asynchronous execution, call the `async()` method: ```java -import com.tryfinch.api.models.HrisDirectoryListPage; +import com.tryfinch.api.client.FinchClient; +import com.tryfinch.api.client.okhttp.FinchOkHttpClient; +import com.tryfinch.api.models.HrisDirectoryListPageAsync; +import com.tryfinch.api.models.HrisDirectoryListParams; +import java.util.concurrent.CompletableFuture; -HrisDirectoryListPage page = client.hris().directory().list().validate(); -``` +FinchClient client = FinchOkHttpClient.builder() + // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables + .fromEnv() + .accessToken("My Access Token") + .build(); -### Response properties as JSON +HrisDirectoryListParams params = HrisDirectoryListParams.builder().build(); +CompletableFuture page = client.async().hris().directory().list(params); +``` -In rare cases, you may want to access the underlying JSON value for a response property rather than using the typed version provided by this SDK. Each model property has a corresponding JSON version, with an underscore before the method name, which returns a `JsonField` value. +Or create an asynchronous client from the beginning: ```java -import com.tryfinch.api.core.JsonField; -import java.util.Optional; - -JsonField field = responseObj._field(); +import com.tryfinch.api.client.FinchClientAsync; +import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync; +import com.tryfinch.api.models.HrisDirectoryListPageAsync; +import com.tryfinch.api.models.HrisDirectoryListParams; +import java.util.concurrent.CompletableFuture; -if (field.isMissing()) { - // Value was not specified in the JSON response -} else if (field.isNull()) { - // Value was provided as a literal null -} else { - // See if value was provided as a string - Optional jsonString = field.asString(); +FinchClientAsync client = FinchOkHttpClientAsync.builder() + // Configures using the `FINCH_CLIENT_ID`, `FINCH_CLIENT_SECRET` and `FINCH_WEBHOOK_SECRET` environment variables + .fromEnv() + .accessToken("My Access Token") + .build(); - // If the value given by the API did not match the shape that the SDK expects - // you can deserialise into a custom type - MyClass myObj = responseObj._field().asUnknown().orElseThrow().convert(MyClass.class); -} +HrisDirectoryListParams params = HrisDirectoryListParams.builder().build(); +CompletableFuture page = client.hris().directory().list(params); ``` -### Additional model properties +The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. -Sometimes, the server response may include additional properties that are not yet available in this library's types. You can access them using the model's `_additionalProperties` method: +## Error handling -```java -import com.tryfinch.api.core.JsonValue; +The SDK throws custom unchecked exception types: -JsonValue secret = operationSupportMatrix._additionalProperties().get("secret_field"); -``` +- [`FinchServiceException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: ---- + | Status | Exception | + | ------ | ------------------------------- | + | 400 | `BadRequestException` | + | 401 | `AuthenticationException` | + | 403 | `PermissionDeniedException` | + | 404 | `NotFoundException` | + | 422 | `UnprocessableEntityException` | + | 429 | `RateLimitException` | + | 5xx | `InternalServerException` | + | others | `UnexpectedStatusCodeException` | + +- [`FinchIoException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchIoException.kt): I/O networking errors. + +- [`FinchInvalidDataException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response. + +- [`FinchException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class. ## Pagination @@ -234,9 +245,21 @@ while (page != null) { } ``` ---- +## Logging ---- +The SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor). + +Enable logging by setting the `FINCH_LOG` environment variable to `info`: + +```sh +$ export FINCH_LOG=info +``` + +Or to `debug` for more verbose logging: + +```sh +$ export FINCH_LOG=debug +``` ## Webhook Verification @@ -248,36 +271,23 @@ both of which will raise an error if the signature is invalid. Note that the "body" parameter must be the raw JSON string sent from the server (do not parse it first). The `.unwrap()` method can parse this JSON for you. ---- - -## Error handling - -This library throws exceptions in a single hierarchy for easy handling: - -- **`FinchException`** - Base exception for all exceptions +## Network options -- **`FinchServiceException`** - HTTP errors with a well-formed response body we were able to parse. The exception message and the `.debuggingRequestId()` will be set by the server. +### Retries - | 400 | BadRequestException | - | ------ | ----------------------------- | - | 401 | AuthenticationException | - | 403 | PermissionDeniedException | - | 404 | NotFoundException | - | 422 | UnprocessableEntityException | - | 429 | RateLimitException | - | 5xx | InternalServerException | - | others | UnexpectedStatusCodeException | +The SDK automatically retries 2 times by default, with a short exponential backoff. -- **`FinchIoException`** - I/O networking errors -- **`FinchInvalidDataException`** - any other exceptions on the client side, e.g.: - - We failed to serialize the request body - - We failed to parse the response body (has access to response code and body) +Only the following error types are retried: -## Network options +- Connection errors (for example, due to a network connectivity problem) +- 408 Request Timeout +- 409 Conflict +- 429 Rate Limit +- 5xx Internal -### Retries +The API may also explicitly instruct the SDK to retry or not retry a response. -Requests that experience certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default. You can provide a `maxRetries` on the client builder to configure this: +To set a custom number of retries, configure the client using the `maxRetries` method: ```java import com.tryfinch.api.client.FinchClient; @@ -285,13 +295,27 @@ import com.tryfinch.api.client.okhttp.FinchOkHttpClient; FinchClient client = FinchOkHttpClient.builder() .fromEnv() + .accessToken("My Access Token") .maxRetries(4) .build(); ``` ### Timeouts -Requests time out after 1 minute by default. You can configure this on the client builder: +Requests time out after 1 minute by default. + +To set a custom timeout, configure the method call using the `timeout` method: + +```java +import com.tryfinch.api.models.HrisDirectoryListPage; +import com.tryfinch.api.models.HrisDirectoryListParams; + +HrisDirectoryListPage page = client.hris().directory().list( + params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() +); +``` + +Or configure the default for all method calls at the client level: ```java import com.tryfinch.api.client.FinchClient; @@ -300,13 +324,14 @@ import java.time.Duration; FinchClient client = FinchOkHttpClient.builder() .fromEnv() + .accessToken("My Access Token") .timeout(Duration.ofSeconds(30)) .build(); ``` ### Proxies -Requests can be routed through a proxy. You can configure this on the client builder: +To route requests through a proxy, configure the client using the `proxy` method: ```java import com.tryfinch.api.client.FinchClient; @@ -316,19 +341,22 @@ import java.net.Proxy; FinchClient client = FinchOkHttpClient.builder() .fromEnv() - .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("example.com", 8080))) + .accessToken("My Access Token") + .proxy(new Proxy( + Proxy.Type.HTTP, new InetSocketAddress( + "https://example.com", 8080 + ) + )) .build(); ``` -## Making custom/undocumented requests - -This library is typed for convenient access to the documented API. If you need to access undocumented params or response properties, the library can still be used. +## Undocumented API functionality -### Undocumented request params +The SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API. -In [Example: creating a resource](#example-creating-a-resource) above, we used the `HrisDirectoryListParams.builder()` to pass to the `list` method of the `directory` service. +### Parameters -Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case, you can attach them using raw setters: +To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class: ```java import com.tryfinch.api.core.JsonValue; @@ -341,28 +369,137 @@ HrisDirectoryListParams params = HrisDirectoryListParams.builder() .build(); ``` -You can also use the `putAdditionalProperty` method on nested headers, query params, or body objects. +These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. You can also set undocumented parameters on nested headers, query params, or body classes using the `putAdditionalProperty` method. These properties can be accessed on the built object later using the `_additionalProperties()` method. -### Undocumented response properties +To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](finch-java-core/src/main/kotlin/com/tryfinch/api/core/JsonValue.kt) object to its setter: -To access undocumented response properties, you can use `res._additionalProperties()` on a response object to get a map of untyped fields of type `Map`. You can then access fields like `res._additionalProperties().get("secret_prop").asString()` or use other helpers defined on the `JsonValue` class to extract it to a desired type. +```java +import com.tryfinch.api.models.HrisDirectoryListParams; -## Logging +HrisDirectoryListParams params = HrisDirectoryListParams.builder().build(); +``` -We use the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor). +### Response properties -You can enable logging by setting the environment variable `FINCH_LOG` to `info`. +To access undocumented response properties, call the `_additionalProperties()` method: -```sh -$ export FINCH_LOG=info +```java +import com.tryfinch.api.core.JsonValue; +import java.util.Map; + +Map additionalProperties = client.accessTokens().create(params)._additionalProperties(); +JsonValue secretPropertyValue = additionalProperties.get("secretProperty"); + +String result = secretPropertyValue.accept(new JsonValue.Visitor<>() { + @Override + public String visitNull() { + return "It's null!"; + } + + @Override + public String visitBoolean(boolean value) { + return "It's a boolean!"; + } + + @Override + public String visitNumber(Number value) { + return "It's a number!"; + } + + // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject` + // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden +}); ``` -Or to `debug` for more verbose logging. +To access a property's raw JSON value, which may be undocumented, call its `_` prefixed method: -```sh -$ export FINCH_LOG=debug +```java +import com.tryfinch.api.core.JsonField; +import java.util.Optional; + +JsonField code = client.accessTokens().create(params)._code(); + +if (code.isMissing()) { + // The property is absent from the JSON response +} else if (code.isNull()) { + // The property was set to literal null +} else { + // Check if value was provided as a string + // Other methods include `asNumber()`, `asBoolean()`, etc. + Optional jsonString = code.asString(); + + // Try to deserialize into a custom type + MyClass myObject = code.asUnknown().orElseThrow().convert(MyClass.class); +} ``` +### Response validation + +In rare cases, the API may return a response that doesn't match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else. + +By default, the SDK will not throw an exception in this case. It will throw [`FinchInvalidDataException`](finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchInvalidDataException.kt) only if you directly access the property. + +If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: + +```java +import com.tryfinch.api.models.CreateAccessTokenResponse; + +CreateAccessTokenResponse createAccessTokenResponse = client.accessTokens().create(params).validate(); +``` + +Or configure the method call to validate the response using the `responseValidation` method: + +```java +import com.tryfinch.api.models.HrisDirectoryListPage; +import com.tryfinch.api.models.HrisDirectoryListParams; + +HrisDirectoryListPage page = client.hris().directory().list( + params, RequestOptions.builder().responseValidation(true).build() +); +``` + +Or configure the default for all method calls at the client level: + +```java +import com.tryfinch.api.client.FinchClient; +import com.tryfinch.api.client.okhttp.FinchOkHttpClient; + +FinchClient client = FinchOkHttpClient.builder() + .fromEnv() + .accessToken("My Access Token") + .responseValidation(true) + .build(); +``` + +## FAQ + +### Why don't you use plain `enum` classes? + +Java `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value. + +### Why do you represent fields using `JsonField` instead of just plain `T`? + +Using `JsonField` enables a few features: + +- Allowing usage of [undocumented API functionality](#undocumented-api-functionality) +- Lazily [validating the API response against the expected shape](#response-validation) +- Representing absent vs explicitly null values + +### Why don't you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)? + +It is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don't want to introduce a breaking change every time we add a field to a class. + +### Why don't you use checked exceptions? + +Checked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason. + +Checked exceptions: + +- Are verbose to handle +- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error +- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function) +- Don't play well with lambdas (also due to the function coloring problem) + ## Semantic versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: diff --git a/build.gradle.kts b/build.gradle.kts index 12e8bf5d..4b46d1a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.tryfinch.api" - version = "4.0.2" // x-release-please-version + version = "4.1.0" // x-release-please-version } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8a1d7a10..d1ed374d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - kotlin("jvm") version "2.1.0" + kotlin("jvm") version "2.1.10" id("com.vanniktech.maven.publish") version "0.28.0" } @@ -10,7 +10,7 @@ repositories { } dependencies { - implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23") + implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10") implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/finch.java.gradle.kts b/buildSrc/src/main/kotlin/finch.java.gradle.kts index a2c35b93..597b6e80 100644 --- a/buildSrc/src/main/kotlin/finch.java.gradle.kts +++ b/buildSrc/src/main/kotlin/finch.java.gradle.kts @@ -39,9 +39,13 @@ tasks.named("jar") { } } -tasks.named("test") { +tasks.withType().configureEach { useJUnitPlatform() + // Run tests in parallel to some degree. + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) + forkEvery = 100 + testLogging { exceptionFormat = TestExceptionFormat.FULL } diff --git a/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts b/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts index c431ae27..9bdebacd 100644 --- a/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/finch.kotlin.gradle.kts @@ -1,4 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -20,13 +21,19 @@ configure { } tasks.withType().configureEach { - kotlinOptions { + compilerOptions { freeCompilerArgs = listOf( "-Xjvm-default=all", "-Xjdk-release=1.8", // Suppress deprecation warnings because we may still reference and test deprecated members. "-Xsuppress-warning=DEPRECATION" ) - jvmTarget = "1.8" + jvmTarget.set(JvmTarget.JVM_1_8) } } + +// Run tests in parallel to some degree. +tasks.withType().configureEach { + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) + forkEvery = 100 +} 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 cd06aa82..7c59fad7 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 @@ -31,10 +31,7 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) : HttpClient { - override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, - ): HttpResponse { + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { val call = newCall(request, requestOptions) return try { @@ -120,13 +117,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val ) { builder.header( "X-Stainless-Read-Timeout", - Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString() + Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), ) } if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { builder.header( "X-Stainless-Timeout", - Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString() + Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), ) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt index 424046b4..bf99f84a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt @@ -64,7 +64,7 @@ interface FinchClient { clientId: String, clientSecret: String, code: String, - redirectUri: String? + redirectUri: String?, ): String fun getAuthUrl(products: String, redirectUri: String, sandbox: Boolean): String diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt index fcba9566..e20d730b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt @@ -65,7 +65,7 @@ interface FinchClientAsync { clientId: String, clientSecret: String, code: String, - redirectUri: String? + redirectUri: String?, ): CompletableFuture fun getAuthUrl(products: String, redirectUri: String, sandbox: Boolean): String 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 2e0e7395..1a33fcc6 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 @@ -38,9 +38,7 @@ import com.tryfinch.api.services.async.WebhookServiceAsyncImpl import java.net.URLEncoder import java.util.concurrent.CompletableFuture -class FinchClientAsyncImpl( - private val clientOptions: ClientOptions, -) : FinchClientAsync { +class FinchClientAsyncImpl(private val clientOptions: ClientOptions) : FinchClientAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -121,7 +119,7 @@ class FinchClientAsyncImpl( clientId: String, clientSecret: String, code: String, - redirectUri: String? + redirectUri: String?, ): CompletableFuture { if (clientOptions.clientId == null) { throw FinchException("clientId must be set in order to call getAccessToken") @@ -136,12 +134,7 @@ class FinchClientAsyncImpl( .body( json( clientOptions.jsonMapper, - GetAccessTokenParams( - clientId, - clientSecret, - code, - redirectUri, - ) + GetAccessTokenParams(clientId, clientSecret, code, redirectUri), ) ) .build() 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 84439057..3f10b2e8 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 @@ -37,9 +37,7 @@ import com.tryfinch.api.services.blocking.WebhookService import com.tryfinch.api.services.blocking.WebhookServiceImpl import java.net.URLEncoder -class FinchClientImpl( - private val clientOptions: ClientOptions, -) : FinchClient { +class FinchClientImpl(private val clientOptions: ClientOptions) : FinchClient { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -110,7 +108,7 @@ class FinchClientImpl( clientId: String, clientSecret: String, code: String, - redirectUri: String? + redirectUri: String?, ): String { if (clientOptions.clientId == null) { throw FinchException("clientId must be set in order to call getAccessToken") @@ -125,12 +123,7 @@ class FinchClientImpl( .body( json( clientOptions.jsonMapper, - GetAccessTokenParams( - clientId, - clientSecret, - code, - redirectUri, - ) + GetAccessTokenParams(clientId, clientSecret, code, redirectUri), ) ) .build() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt index cc970627..c850405c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/BaseDeserializer.kt @@ -18,7 +18,7 @@ abstract class BaseDeserializer(type: KClass) : override fun createContextual( context: DeserializationContext, - property: BeanProperty? + property: BeanProperty?, ): JsonDeserializer { return this } @@ -32,7 +32,7 @@ abstract class BaseDeserializer(type: KClass) : protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: TypeReference, - validate: (T) -> Unit = {} + validate: (T) -> Unit = {}, ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) @@ -46,7 +46,7 @@ abstract class BaseDeserializer(type: KClass) : protected fun ObjectCodec.tryDeserialize( node: JsonNode, type: JavaType, - validate: (T) -> Unit = {} + validate: (T) -> Unit = {}, ): T? { return try { readValue(treeAsTokens(node), type).apply(validate) 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 15542787..f34021de 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 @@ -212,7 +212,7 @@ private constructor( if (!username.isEmpty() && !password.isEmpty()) { headers.put( "Authorization", - "Basic ${Base64.getEncoder().encodeToString("$username:$password".toByteArray())}" + "Basic ${Base64.getEncoder().encodeToString("$username:$password".toByteArray())}", ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt index 9361c66b..4d3d1862 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/HttpRequestBodies.kt @@ -10,10 +10,7 @@ import java.io.OutputStream import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder @JvmSynthetic -internal inline fun json( - jsonMapper: JsonMapper, - value: T, -): HttpRequestBody { +internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody { return object : HttpRequestBody { private var cachedBytes: ByteArray? = null @@ -49,7 +46,7 @@ internal inline fun json( @JvmSynthetic internal fun multipartFormData( jsonMapper: JsonMapper, - parts: Array?> + parts: Array?>, ): HttpRequestBody { val builder = MultipartEntityBuilder.create() parts.forEach { part -> @@ -66,14 +63,14 @@ internal fun multipartFormData( part.name, buffer.toByteArray(), part.contentType, - part.filename + part.filename, ) } is Boolean -> builder.addTextBody( part.name, if (part.value) "true" else "false", - part.contentType + part.contentType, ) is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType) is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/PrepareRequest.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/PrepareRequest.kt index 974ae9d8..6e1aaafb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/PrepareRequest.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/PrepareRequest.kt @@ -17,7 +17,7 @@ internal fun HttpRequest.prepare(clientOptions: ClientOptions, params: Params): @JvmSynthetic internal fun HttpRequest.prepareAsync( clientOptions: ClientOptions, - params: Params + params: Params, ): CompletableFuture = // This async version exists to make it easier to add async specific preparation logic in the // future. diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt index b31943e2..cee1a369 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/RequestOptions.kt @@ -2,11 +2,7 @@ package com.tryfinch.api.core import java.time.Duration -class RequestOptions -private constructor( - val responseValidation: Boolean?, - val timeout: Duration?, -) { +class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) { fun applyDefaults(options: RequestOptions): RequestOptions { return RequestOptions( responseValidation = this.responseValidation ?: options.responseValidation, diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt index 16ad91e7..0879a0f2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/Values.kt @@ -59,36 +59,69 @@ sealed class JsonField { fun asBoolean(): Optional = when (this) { is JsonBoolean -> Optional.of(value) + is KnownValue -> Optional.ofNullable(value as? Boolean) else -> Optional.empty() } fun asNumber(): Optional = when (this) { is JsonNumber -> Optional.of(value) + is KnownValue -> Optional.ofNullable(value as? Number) else -> Optional.empty() } fun asString(): Optional = when (this) { is JsonString -> Optional.of(value) + is KnownValue -> Optional.ofNullable(value as? String) else -> Optional.empty() } fun asStringOrThrow(): String = - when (this) { - is JsonString -> value - else -> throw FinchInvalidDataException("Value is not a string") - } + asString().orElseThrow { FinchInvalidDataException("Value is not a string") } fun asArray(): Optional> = when (this) { is JsonArray -> Optional.of(values) + is KnownValue -> + Optional.ofNullable( + (value as? List<*>)?.map { + try { + JsonValue.from(it) + } catch (e: IllegalArgumentException) { + // The known value is a list, but not all values are convertible to + // `JsonValue`. + return Optional.empty() + } + } + ) else -> Optional.empty() } fun asObject(): Optional> = when (this) { is JsonObject -> Optional.of(values) + is KnownValue -> + Optional.ofNullable( + (value as? Map<*, *>) + ?.map { (key, value) -> + if (key !is String) { + return Optional.empty() + } + + val jsonValue = + try { + JsonValue.from(value) + } catch (e: IllegalArgumentException) { + // The known value is a map, but not all items are convertible + // to `JsonValue`. + return Optional.empty() + } + + key to jsonValue + } + ?.toMap() + ) else -> Optional.empty() } @@ -96,9 +129,9 @@ sealed class JsonField { internal fun getRequired(name: String): T = when (this) { is KnownValue -> value - is JsonMissing -> throw FinchInvalidDataException("'${name}' is not set") - is JsonNull -> throw FinchInvalidDataException("'${name}' is null") - else -> throw FinchInvalidDataException("'${name}' is invalid, received ${this}") + is JsonMissing -> throw FinchInvalidDataException("`$name` is not set") + is JsonNull -> throw FinchInvalidDataException("`$name` is null") + else -> throw FinchInvalidDataException("`$name` is invalid, received $this") } @JvmSynthetic @@ -107,7 +140,7 @@ sealed class JsonField { is KnownValue -> value is JsonMissing -> null is JsonNull -> null - else -> throw FinchInvalidDataException("'${name}' is invalid, received ${this}") + else -> throw FinchInvalidDataException("`$name` is invalid, received $this") } @JvmSynthetic @@ -140,8 +173,11 @@ sealed class JsonField { } } - // This class is a Jackson filter that can be used to exclude missing properties from objects - // This filter should not be used directly and should instead use the @ExcludeMissing annotation + /** + * This class is a Jackson filter that can be used to exclude missing properties from objects. + * This filter should not be used directly and should instead use the @ExcludeMissing + * annotation. + */ class IsMissing { override fun equals(other: Any?): Boolean = other is JsonMissing @@ -154,18 +190,13 @@ sealed class JsonField { override fun createContextual( context: DeserializationContext, property: BeanProperty?, - ): JsonDeserializer> { - return Deserializer(context.contextualType?.containedType(0)) - } + ): JsonDeserializer> = Deserializer(context.contextualType?.containedType(0)) - override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> { - return type?.let { tryDeserialize(node, type) }?.let { of(it) } + override fun ObjectCodec.deserialize(node: JsonNode): JsonField<*> = + type?.let { tryDeserialize(node, type) }?.let { of(it) } ?: JsonValue.fromJsonNode(node) - } - override fun getNullValue(context: DeserializationContext): JsonField<*> { - return JsonNull.of() - } + override fun getNullValue(context: DeserializationContext): JsonField<*> = JsonNull.of() } } @@ -240,13 +271,9 @@ sealed class JsonValue : JsonField() { } class Deserializer : BaseDeserializer(JsonValue::class) { - override fun ObjectCodec.deserialize(node: JsonNode): JsonValue { - return fromJsonNode(node) - } + override fun ObjectCodec.deserialize(node: JsonNode): JsonValue = fromJsonNode(node) - override fun getNullValue(context: DeserializationContext?): JsonValue { - return JsonNull.of() - } + override fun getNullValue(context: DeserializationContext?): JsonValue = JsonNull.of() } } @@ -287,7 +314,7 @@ class JsonMissing : JsonValue() { override fun serialize( value: JsonMissing, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { throw RuntimeException("JsonMissing cannot be serialized") } @@ -422,10 +449,7 @@ private constructor( } @JacksonAnnotationsInside -@JsonInclude( - JsonInclude.Include.CUSTOM, - valueFilter = JsonField.IsMissing::class, -) +@JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing @JacksonAnnotationsInside @@ -434,7 +458,7 @@ annotation class ExcludeMissing isGetterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, creatorVisibility = Visibility.NONE, - fieldVisibility = Visibility.NONE + fieldVisibility = Visibility.NONE, ) annotation class NoAutoDetect @@ -443,7 +467,7 @@ internal constructor( val name: String, val value: T, val contentType: ContentType, - val filename: String? = null + val filename: String? = null, ) { private var hashCode: Int = 0 @@ -462,7 +486,7 @@ internal constructor( is Long -> value is Double -> value else -> value?.hashCode() - } + }, ) } return hashCode @@ -496,7 +520,7 @@ internal constructor( internal fun fromString( name: String, value: String, - contentType: ContentType + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromBoolean( @@ -520,14 +544,14 @@ internal constructor( internal fun fromEnum( name: String, value: T, - contentType: ContentType + contentType: ContentType, ): MultipartFormValue = MultipartFormValue(name, value, contentType) internal fun fromByteArray( name: String, value: ByteArray, contentType: ContentType, - filename: String? = null + filename: String? = null, ): MultipartFormValue = MultipartFormValue(name, value, contentType, filename) } } 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 1a95b473..b3b56dec 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 @@ -6,7 +6,7 @@ import java.util.TreeMap class Headers private constructor( private val map: Map>, - @get:JvmName("size") val size: Int + @get:JvmName("size") val size: Int, ) { fun isEmpty(): Boolean = map.isEmpty() @@ -74,7 +74,7 @@ private constructor( values.toImmutable() } .toImmutable(), - size + size, ) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt index 168c41e9..293114df 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpClient.kt @@ -19,4 +19,7 @@ interface HttpClient : AutoCloseable { request: HttpRequest, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ + override fun close() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBody.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBody.kt index 678c36e2..ac13d310 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBody.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpRequestBody.kt @@ -1,12 +1,11 @@ package com.tryfinch.api.core.http -import java.io.IOException import java.io.OutputStream import java.lang.AutoCloseable interface HttpRequestBody : AutoCloseable { - @Throws(IOException::class) fun writeTo(outputStream: OutputStream) + fun writeTo(outputStream: OutputStream) fun contentType(): String? @@ -21,5 +20,6 @@ interface HttpRequestBody : AutoCloseable { */ fun repeatable(): Boolean + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ override fun close() } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt index 60280415..ad9844e8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/HttpResponse.kt @@ -11,6 +11,9 @@ interface HttpResponse : AutoCloseable { fun body(): InputStream + /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */ + override fun close() + interface Handler { fun handle(response: HttpResponse): T diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/PhantomReachableClosingHttpClient.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/PhantomReachableClosingHttpClient.kt index 82a11397..c0fcdc44 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/PhantomReachableClosingHttpClient.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/PhantomReachableClosingHttpClient.kt @@ -19,7 +19,7 @@ internal class PhantomReachableClosingHttpClient(private val httpClient: HttpCli override fun executeAsync( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture = httpClient.executeAsync(request, requestOptions) override fun close() = httpClient.close() 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 73766d6a..e35ea929 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 @@ -5,7 +5,7 @@ import com.tryfinch.api.core.toImmutable class QueryParams private constructor( private val map: Map>, - @get:JvmName("size") val size: Int + @get:JvmName("size") val size: Int, ) { fun isEmpty(): Boolean = map.isEmpty() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/RetryingHttpClient.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/RetryingHttpClient.kt index 29095887..77823c9b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/RetryingHttpClient.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/core/http/RetryingHttpClient.kt @@ -28,10 +28,7 @@ private constructor( private val idempotencyHeader: String?, ) : HttpClient { - override fun execute( - request: HttpRequest, - requestOptions: RequestOptions, - ): HttpResponse { + override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse { if (!isRetryable(request) || maxRetries <= 0) { return httpClient.execute(request, requestOptions) } @@ -100,7 +97,7 @@ private constructor( .handleAsync( fun( response: HttpResponse?, - throwable: Throwable? + throwable: Throwable?, ): CompletableFuture { if (response != null) { if (++retries > maxRetries || !shouldRetry(response)) { @@ -120,7 +117,7 @@ private constructor( return sleepAsync(backoffMillis.toMillis()).thenCompose { executeWithRetries(requestWithRetryCount, requestOptions) } - }, + } ) { // Run in the same thread. it.run() @@ -200,8 +197,8 @@ private constructor( OffsetDateTime.now(clock), OffsetDateTime.parse( retryAfter, - DateTimeFormatter.RFC_1123_DATE_TIME - ) + DateTimeFormatter.RFC_1123_DATE_TIME, + ), ) } catch (e: DateTimeParseException) { null @@ -239,7 +236,7 @@ private constructor( future.complete(null) } }, - millis + millis, ) return future } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt index c688913c..1375ba00 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/BadRequestException.kt @@ -2,8 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class BadRequestException( - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(400, headers, body, error) +class BadRequestException(headers: Headers, body: String, error: FinchError) : + FinchServiceException(400, headers, body, error) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt index 7a51327d..db1b299f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchError.kt @@ -20,7 +20,7 @@ private constructor( @ExcludeMissing @JsonAnySetter @get:JvmName("additionalProperties") - val additionalProperties: Map = immutableEmptyMap(), + val additionalProperties: Map = immutableEmptyMap() ) { fun toBuilder() = Builder().from(this) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt index 1a4c2000..9fa5ecc4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/FinchServiceException.kt @@ -10,7 +10,7 @@ constructor( private val body: String, private val error: FinchError, message: String = "$statusCode: $error", - cause: Throwable? = null + cause: Throwable? = null, ) : FinchException(message, cause) { fun statusCode(): Int = statusCode diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt index 1b08ca2a..8701e4a7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/InternalServerException.kt @@ -2,9 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class InternalServerException( - statusCode: Int, - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(statusCode, headers, body, error) +class InternalServerException(statusCode: Int, headers: Headers, body: String, error: FinchError) : + FinchServiceException(statusCode, headers, body, error) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt index 5a3bbcd9..370a60c4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/NotFoundException.kt @@ -2,8 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class NotFoundException( - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(404, headers, body, error) +class NotFoundException(headers: Headers, body: String, error: FinchError) : + FinchServiceException(404, headers, body, error) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt index 5f50ddd5..36058d72 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/PermissionDeniedException.kt @@ -2,8 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class PermissionDeniedException( - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(403, headers, body, error) +class PermissionDeniedException(headers: Headers, body: String, error: FinchError) : + FinchServiceException(403, headers, body, error) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt index 7a54435d..f14024da 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/RateLimitException.kt @@ -2,8 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class RateLimitException( - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(429, headers, body, error) +class RateLimitException(headers: Headers, body: String, error: FinchError) : + FinchServiceException(429, headers, body, error) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt index d762046f..a060f3d4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnauthorizedException.kt @@ -2,8 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class UnauthorizedException( - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(401, headers, body, error) +class UnauthorizedException(headers: Headers, body: String, error: FinchError) : + FinchServiceException(401, headers, body, error) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt index 34f27cb7..6efe853c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/errors/UnprocessableEntityException.kt @@ -2,8 +2,5 @@ package com.tryfinch.api.errors import com.tryfinch.api.core.http.Headers -class UnprocessableEntityException( - headers: Headers, - body: String, - error: FinchError, -) : FinchServiceException(422, headers, body, error) +class UnprocessableEntityException(headers: Headers, body: String, error: FinchError) : + FinchServiceException(422, headers, body, error) 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 c45bcbb2..38868876 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 @@ -23,7 +23,7 @@ import java.util.Optional /** Exchange the authorization code for an access token */ class AccessTokenCreateParams private constructor( - private val body: AccessTokenCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -50,16 +50,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): AccessTokenCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class AccessTokenCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("code") @ExcludeMissing private val code: JsonField = JsonMissing.of(), @@ -104,7 +104,7 @@ private constructor( private var validated: Boolean = false - fun validate(): AccessTokenCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -123,7 +123,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AccessTokenCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var code: JsonField? = null @@ -133,12 +133,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(accessTokenCreateBody: AccessTokenCreateBody) = apply { - code = accessTokenCreateBody.code - clientId = accessTokenCreateBody.clientId - clientSecret = accessTokenCreateBody.clientSecret - redirectUri = accessTokenCreateBody.redirectUri - additionalProperties = accessTokenCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + code = body.code + clientId = body.clientId + clientSecret = body.clientSecret + redirectUri = body.redirectUri + additionalProperties = body.additionalProperties.toMutableMap() } fun code(code: String) = code(JsonField.of(code)) @@ -180,8 +180,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): AccessTokenCreateBody = - AccessTokenCreateBody( + fun build(): Body = + Body( checkRequired("code", code), clientId, clientSecret, @@ -195,7 +195,7 @@ private constructor( return true } - return /* spotless:off */ other is AccessTokenCreateBody && code == other.code && clientId == other.clientId && clientSecret == other.clientSecret && redirectUri == other.redirectUri && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && code == other.code && clientId == other.clientId && clientSecret == other.clientSecret && redirectUri == other.redirectUri && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -205,7 +205,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AccessTokenCreateBody{code=$code, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" + "Body{code=$code, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -219,7 +219,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: AccessTokenCreateBody.Builder = AccessTokenCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt index 030c0f24..fbbf3441 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountCreateResponse.kt @@ -241,9 +241,7 @@ private constructor( class AuthenticationType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -330,7 +328,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt index 7b811c69..5925dc19 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateEvent.kt @@ -1218,11 +1218,7 @@ private constructor( } fun build(): Departments = - Departments( - name, - parent, - additionalProperties.toImmutable(), - ) + Departments(name, parent, additionalProperties.toImmutable()) } @NoAutoDetect @@ -1446,11 +1442,7 @@ private constructor( } fun build(): Entity = - Entity( - subtype, - type, - additionalProperties.toImmutable(), - ) + Entity(subtype, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -2221,11 +2213,7 @@ private constructor( } fun build(): Paging = - Paging( - count, - offset, - additionalProperties.toImmutable(), - ) + Paging(count, offset, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -2863,11 +2851,7 @@ private constructor( } fun build(): Employment = - Employment( - subtype, - type, - additionalProperties.toImmutable(), - ) + Employment(subtype, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -3003,12 +2987,7 @@ private constructor( } fun build(): Income = - Income( - amount, - currency, - unit, - additionalProperties.toImmutable(), - ) + Income(amount, currency, unit, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -3751,11 +3730,7 @@ private constructor( } fun build(): Emails = - Emails( - data, - type, - additionalProperties.toImmutable(), - ) + Emails(data, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -3871,11 +3846,7 @@ private constructor( } fun build(): PhoneNumbers = - PhoneNumbers( - data, - type, - additionalProperties.toImmutable(), - ) + PhoneNumbers(data, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -5912,11 +5883,7 @@ private constructor( } fun build(): PayPeriod = - PayPeriod( - endDate, - startDate, - additionalProperties.toImmutable(), - ) + PayPeriod(endDate, startDate, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -5974,11 +5941,8 @@ private constructor( } /** The type of authentication method. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -6071,7 +6035,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -6122,11 +6098,7 @@ private constructor( "Data{authenticationMethod=$authenticationMethod, status=$status, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -6147,7 +6119,7 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { - ACCOUNT_UPDATED, + ACCOUNT_UPDATED } /** @@ -6194,7 +6166,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt index 0d82edfa..ef5ca08a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AccountUpdateResponse.kt @@ -226,9 +226,7 @@ private constructor( class AuthenticationType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -315,7 +313,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt index 83f762e9..4a7fd197 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/AutomatedAsyncJob.kt @@ -412,11 +412,7 @@ private constructor( "Params{individualId=$individualId, additionalProperties=$additionalProperties}" } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -512,7 +508,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -528,11 +534,7 @@ private constructor( } /** The type of automated job */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -604,7 +606,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { 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 dc207e16..bfef1c4b 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 @@ -118,19 +118,11 @@ private constructor( } fun build(): BenefitContribution = - BenefitContribution( - amount, - type, - additionalProperties.toImmutable(), - ) + BenefitContribution(amount, type, additionalProperties.toImmutable()) } /** Contribution type. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -202,7 +194,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt index 6a1b7702..e59b1426 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitFeaturesAndOperations.kt @@ -493,9 +493,7 @@ private constructor( class CompanyContribution @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -573,7 +571,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown CompanyContribution: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -590,9 +600,7 @@ private constructor( class EmployeeDeduction @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -669,7 +677,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EmployeeDeduction: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -686,9 +706,7 @@ private constructor( class HsaContributionLimit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -766,7 +784,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown HsaContributionLimit: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { 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 a574a104..3a3183a0 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 @@ -7,11 +7,8 @@ import com.tryfinch.api.core.Enum import com.tryfinch.api.core.JsonField import com.tryfinch.api.errors.FinchInvalidDataException -class BenefitFrequency -@JsonCreator -private constructor( - private val value: JsonField, -) : Enum { +class BenefitFrequency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -90,7 +87,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown BenefitFrequency: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt index dd5abd4c..4f7b1a34 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/BenefitType.kt @@ -8,11 +8,7 @@ import com.tryfinch.api.core.JsonField import com.tryfinch.api.errors.FinchInvalidDataException /** Type of benefit. */ -class BenefitType -@JsonCreator -private constructor( - private val value: JsonField, -) : Enum { +class BenefitType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -185,7 +181,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown BenefitType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt index 0314da32..4501824b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Company.kt @@ -556,11 +556,8 @@ private constructor( } /** The type of bank account. */ - class AccountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class AccountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -636,7 +633,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AccountType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -769,12 +778,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Department = - Department( - name, - parent, - additionalProperties.toImmutable(), - ) + fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) } /** The parent department, if present. */ @@ -998,20 +1002,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Entity = - Entity( - subtype, - type, - additionalProperties.toImmutable(), - ) + fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } /** The tax payer subtype of the company. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1092,7 +1088,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1108,11 +1116,7 @@ private constructor( } /** The tax payer type of the company. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1215,7 +1219,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt index 1b603827..160468eb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyEvent.kt @@ -220,7 +220,7 @@ private constructor( @JsonCreator private constructor( @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), + private val additionalProperties: Map = immutableEmptyMap() ) { @JsonAnyGetter @@ -293,11 +293,7 @@ private constructor( override fun toString() = "Data{additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -318,7 +314,7 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { - COMPANY_UPDATED, + COMPANY_UPDATED } /** @@ -365,7 +361,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt index 94219b90..6e276c55 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CompanyUpdateResponse.kt @@ -539,11 +539,8 @@ private constructor( } /** The type of bank account. */ - class AccountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class AccountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -619,7 +616,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AccountType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -752,12 +761,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Department = - Department( - name, - parent, - additionalProperties.toImmutable(), - ) + fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) } /** The parent department, if present. */ @@ -981,20 +985,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Entity = - Entity( - subtype, - type, - additionalProperties.toImmutable(), - ) + fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } /** The tax payer subtype of the company. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1075,7 +1071,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1091,11 +1099,7 @@ private constructor( } /** The tax payer type of the company. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1198,7 +1202,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { 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 29c5f4e9..622a3456 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 @@ -25,7 +25,7 @@ import java.util.Optional /** Create a new connect session for an employer */ class ConnectSessionNewParams private constructor( - private val body: ConnectSessionNewBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -74,16 +74,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): ConnectSessionNewBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class ConnectSessionNewBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("customer_id") @ExcludeMissing private val customerId: JsonField = JsonMissing.of(), @@ -181,7 +181,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ConnectSessionNewBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -205,7 +205,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ConnectSessionNewBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var customerId: JsonField? = null @@ -220,17 +220,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(connectSessionNewBody: ConnectSessionNewBody) = apply { - customerId = connectSessionNewBody.customerId - customerName = connectSessionNewBody.customerName - products = connectSessionNewBody.products.map { it.toMutableList() } - customerEmail = connectSessionNewBody.customerEmail - integration = connectSessionNewBody.integration - manual = connectSessionNewBody.manual - minutesToExpire = connectSessionNewBody.minutesToExpire - redirectUri = connectSessionNewBody.redirectUri - sandbox = connectSessionNewBody.sandbox - additionalProperties = connectSessionNewBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + customerId = body.customerId + customerName = body.customerName + products = body.products.map { it.toMutableList() } + customerEmail = body.customerEmail + integration = body.integration + manual = body.manual + minutesToExpire = body.minutesToExpire + redirectUri = body.redirectUri + sandbox = body.sandbox + additionalProperties = body.additionalProperties.toMutableMap() } fun customerId(customerId: String) = customerId(JsonField.of(customerId)) @@ -354,8 +354,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ConnectSessionNewBody = - ConnectSessionNewBody( + fun build(): Body = + Body( checkRequired("customerId", customerId), checkRequired("customerName", customerName), checkRequired("products", products).map { it.toImmutable() }, @@ -374,7 +374,7 @@ private constructor( return true } - return /* spotless:off */ other is ConnectSessionNewBody && customerId == other.customerId && customerName == other.customerName && products == other.products && customerEmail == other.customerEmail && integration == other.integration && manual == other.manual && minutesToExpire == other.minutesToExpire && redirectUri == other.redirectUri && sandbox == other.sandbox && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && customerId == other.customerId && customerName == other.customerName && products == other.products && customerEmail == other.customerEmail && integration == other.integration && manual == other.manual && minutesToExpire == other.minutesToExpire && redirectUri == other.redirectUri && sandbox == other.sandbox && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -384,7 +384,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ConnectSessionNewBody{customerId=$customerId, customerName=$customerName, products=$products, customerEmail=$customerEmail, integration=$integration, manual=$manual, minutesToExpire=$minutesToExpire, redirectUri=$redirectUri, sandbox=$sandbox, additionalProperties=$additionalProperties}" + "Body{customerId=$customerId, customerName=$customerName, products=$products, customerEmail=$customerEmail, integration=$integration, manual=$manual, minutesToExpire=$minutesToExpire, redirectUri=$redirectUri, sandbox=$sandbox, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -398,7 +398,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: ConnectSessionNewBody.Builder = ConnectSessionNewBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -615,11 +615,8 @@ private constructor( } /** The Finch products that can be requested during the Connect flow. */ - class ConnectProducts - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ConnectProducts @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -730,7 +727,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ConnectProducts: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -841,18 +848,11 @@ private constructor( } fun build(): Integration = - Integration( - authMethod, - provider, - additionalProperties.toImmutable(), - ) + Integration(authMethod, provider, additionalProperties.toImmutable()) } - class AuthMethod - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class AuthMethod @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -940,7 +940,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AuthMethod: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -973,11 +985,7 @@ private constructor( "Integration{authMethod=$authMethod, provider=$provider, additionalProperties=$additionalProperties}" } - class Sandbox - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Sandbox @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1049,7 +1057,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Sandbox: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { 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 1073bff0..50101242 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 @@ -25,7 +25,7 @@ import java.util.Optional /** Create a new Connect session for reauthenticating an existing connection */ class ConnectSessionReauthenticateParams private constructor( - private val body: ConnectSessionReauthenticateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -60,16 +60,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): ConnectSessionReauthenticateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class ConnectSessionReauthenticateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("connection_id") @ExcludeMissing private val connectionId: JsonField = JsonMissing.of(), @@ -131,7 +131,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ConnectSessionReauthenticateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -150,7 +150,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ConnectSessionReauthenticateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var connectionId: JsonField? = null @@ -160,15 +160,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(connectSessionReauthenticateBody: ConnectSessionReauthenticateBody) = - apply { - connectionId = connectSessionReauthenticateBody.connectionId - minutesToExpire = connectSessionReauthenticateBody.minutesToExpire - products = connectSessionReauthenticateBody.products.map { it.toMutableList() } - redirectUri = connectSessionReauthenticateBody.redirectUri - additionalProperties = - connectSessionReauthenticateBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + connectionId = body.connectionId + minutesToExpire = body.minutesToExpire + products = body.products.map { it.toMutableList() } + redirectUri = body.redirectUri + additionalProperties = body.additionalProperties.toMutableMap() + } /** The ID of the existing connection to reauthenticate */ fun connectionId(connectionId: String) = connectionId(JsonField.of(connectionId)) @@ -264,8 +262,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): ConnectSessionReauthenticateBody = - ConnectSessionReauthenticateBody( + fun build(): Body = + Body( checkRequired("connectionId", connectionId), minutesToExpire, (products ?: JsonMissing.of()).map { it.toImmutable() }, @@ -279,7 +277,7 @@ private constructor( return true } - return /* spotless:off */ other is ConnectSessionReauthenticateBody && connectionId == other.connectionId && minutesToExpire == other.minutesToExpire && products == other.products && redirectUri == other.redirectUri && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && connectionId == other.connectionId && minutesToExpire == other.minutesToExpire && products == other.products && redirectUri == other.redirectUri && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -289,7 +287,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ConnectSessionReauthenticateBody{connectionId=$connectionId, minutesToExpire=$minutesToExpire, products=$products, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" + "Body{connectionId=$connectionId, minutesToExpire=$minutesToExpire, products=$products, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -303,8 +301,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: ConnectSessionReauthenticateBody.Builder = - ConnectSessionReauthenticateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -498,11 +495,8 @@ private constructor( } /** The Finch products that can be requested during the Connect flow. */ - class ConnectProducts - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ConnectProducts @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -613,7 +607,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ConnectProducts: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt index 49be8e42..36084ea1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionCreateResponse.kt @@ -257,9 +257,7 @@ private constructor( class AuthenticationType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -346,7 +344,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt index b87840e6..8911a636 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ConnectionStatusType.kt @@ -7,11 +7,8 @@ import com.tryfinch.api.core.Enum import com.tryfinch.api.core.JsonField import com.tryfinch.api.errors.FinchInvalidDataException -class ConnectionStatusType -@JsonCreator -private constructor( - private val value: JsonField, -) : Enum { +class ConnectionStatusType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -109,7 +106,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ConnectionStatusType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt index 312150e0..1030bc51 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateAccessTokenResponse.kt @@ -354,11 +354,7 @@ private constructor( } /** The type of application associated with a token. */ - class ClientType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ClientType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -438,7 +434,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ClientType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -458,11 +464,8 @@ private constructor( * - `provider` - connection to an external provider * - `finch` - finch-generated data. */ - class ConnectionType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ConnectionType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -537,7 +540,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ConnectionType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt index 182bc3e7..c526676e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/CreateCompanyBenefitsResponse.kt @@ -90,7 +90,7 @@ private constructor( fun build(): CreateCompanyBenefitsResponse = CreateCompanyBenefitsResponse( checkRequired("benefitId", benefitId), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt index 750c01b2..078fdd80 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DirectoryEvent.kt @@ -315,11 +315,7 @@ private constructor( "Data{individualId=$individualId, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -399,7 +395,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt index 6d71abd4..d0469b43 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -200,22 +200,11 @@ private constructor( } fun build(): DocumentResponse = - DocumentResponse( - id, - individualId, - type, - url, - year, - additionalProperties.toImmutable(), - ) + DocumentResponse(id, individualId, type, url, year, additionalProperties.toImmutable()) } /** The type of document. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -287,7 +276,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt index 83153e62..4fa2026a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt @@ -188,7 +188,7 @@ private constructor( override fun serialize( value: DocumentRetreiveResponse, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.w42020 != null -> generator.writeObject(value.w42020) 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 d0d6ea8d..75f7e6db 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 @@ -697,12 +697,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomField = - CustomField( - name, - value, - additionalProperties.toImmutable(), - ) + fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -938,23 +933,15 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Employment = - Employment( - subtype, - type, - additionalProperties.toImmutable(), - ) + fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1053,7 +1040,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1069,11 +1068,7 @@ private constructor( } /** The main employment type of the individual. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1146,7 +1141,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1183,11 +1190,8 @@ private constructor( * The detailed employment status of the individual. Available options: `active`, `deceased`, * `leave`, `onboarding`, `prehire`, `retired`, `terminated`. */ - class EmploymentStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EmploymentStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1292,7 +1296,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EmploymentStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt index 2b83375e..28da48df 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentDataResponse.kt @@ -119,12 +119,7 @@ private constructor( } fun build(): EmploymentDataResponse = - EmploymentDataResponse( - body, - code, - individualId, - additionalProperties.toImmutable(), - ) + EmploymentDataResponse(body, code, individualId, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt index f9bd150a..b67ef641 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentEvent.kt @@ -315,11 +315,7 @@ private constructor( "Data{individualId=$individualId, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -399,7 +395,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt index 4ea8b3f5..f900c3bb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EmploymentUpdateResponse.kt @@ -646,12 +646,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomField = - CustomField( - name, - value, - additionalProperties.toImmutable(), - ) + fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -887,23 +882,15 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Employment = - Employment( - subtype, - type, - additionalProperties.toImmutable(), - ) + fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1002,7 +989,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1018,11 +1017,7 @@ private constructor( } /** The main employment type of the individual. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1095,7 +1090,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1129,11 +1136,8 @@ private constructor( } /** The detailed employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EmploymentStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1238,7 +1242,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EmploymentStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt index 7ac3fc5c..8f31d858 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/EnrolledIndividual.kt @@ -17,6 +17,7 @@ import com.tryfinch.api.core.toImmutable import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull @NoAutoDetect class EnrolledIndividual @@ -123,12 +124,7 @@ private constructor( } fun build(): EnrolledIndividual = - EnrolledIndividual( - body, - code, - individualId, - additionalProperties.toImmutable(), - ) + EnrolledIndividual(body, code, individualId, additionalProperties.toImmutable()) } @NoAutoDetect @@ -252,13 +248,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Body = - Body( - finchCode, - message, - name, - additionalProperties.toImmutable(), - ) + fun build(): Body = Body(finchCode, message, name, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -280,11 +270,7 @@ private constructor( } /** HTTP status code. Either 201 or 200 */ - class Code - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Code @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -368,7 +354,16 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Code: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asLong(): Long = + _value().asNumber().getOrNull()?.let { + if (it.toDouble() % 1 == 0.0) it.toLong() else null + } ?: throw FinchInvalidDataException("Value is not a Long") override fun equals(other: Any?): Boolean { if (this === other) { 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 cb2ec7dc..5f17f2f8 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 @@ -25,7 +25,7 @@ import java.util.Optional */ class HrisBenefitCreateParams private constructor( - private val body: HrisBenefitCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -58,16 +58,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): HrisBenefitCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class HrisBenefitCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), @@ -115,7 +115,7 @@ private constructor( private var validated: Boolean = false - fun validate(): HrisBenefitCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -133,7 +133,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [HrisBenefitCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var description: JsonField = JsonMissing.of() @@ -142,11 +142,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(hrisBenefitCreateBody: HrisBenefitCreateBody) = apply { - description = hrisBenefitCreateBody.description - frequency = hrisBenefitCreateBody.frequency - type = hrisBenefitCreateBody.type - additionalProperties = hrisBenefitCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + description = body.description + frequency = body.frequency + type = body.type + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -201,13 +201,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): HrisBenefitCreateBody = - HrisBenefitCreateBody( - description, - frequency, - type, - additionalProperties.toImmutable(), - ) + fun build(): Body = + Body(description, frequency, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -215,7 +210,7 @@ private constructor( return true } - return /* spotless:off */ other is HrisBenefitCreateBody && description == other.description && frequency == other.frequency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && description == other.description && frequency == other.frequency && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -225,7 +220,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "HrisBenefitCreateBody{description=$description, frequency=$frequency, type=$type, additionalProperties=$additionalProperties}" + "Body{description=$description, frequency=$frequency, type=$type, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -239,7 +234,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: HrisBenefitCreateBody.Builder = HrisBenefitCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 8af049c0..d00f2f3a 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 @@ -64,13 +64,8 @@ private constructor( fun of( individualsService: IndividualService, params: HrisBenefitIndividualRetrieveManyBenefitsParams, - response: Response - ) = - HrisBenefitIndividualRetrieveManyBenefitsPage( - individualsService, - params, - response, - ) + response: Response, + ) = HrisBenefitIndividualRetrieveManyBenefitsPage(individualsService, params, response) } @NoAutoDetect @@ -146,9 +141,8 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 3b65576e..6c87b64f 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 @@ -68,13 +68,8 @@ private constructor( fun of( individualsService: IndividualServiceAsync, params: HrisBenefitIndividualRetrieveManyBenefitsParams, - response: Response - ) = - HrisBenefitIndividualRetrieveManyBenefitsPageAsync( - individualsService, - params, - response, - ) + response: Response, + ) = HrisBenefitIndividualRetrieveManyBenefitsPageAsync(individualsService, params, response) } @NoAutoDetect @@ -150,18 +145,16 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPageAsync, - ) { + class AutoPager(private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture> .forEach( action: (IndividualBenefit) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -170,7 +163,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt index cdb9f7ac..fbd19014 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPage.kt @@ -64,13 +64,8 @@ private constructor( fun of( individualsService: IndividualService, params: HrisBenefitIndividualUnenrollManyParams, - response: Response - ) = - HrisBenefitIndividualUnenrollManyPage( - individualsService, - params, - response, - ) + response: Response, + ) = HrisBenefitIndividualUnenrollManyPage(individualsService, params, response) } @NoAutoDetect @@ -146,9 +141,8 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitIndividualUnenrollManyPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt index fafba6a4..2540f64e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyPageAsync.kt @@ -67,13 +67,8 @@ private constructor( fun of( individualsService: IndividualServiceAsync, params: HrisBenefitIndividualUnenrollManyParams, - response: Response - ) = - HrisBenefitIndividualUnenrollManyPageAsync( - individualsService, - params, - response, - ) + response: Response, + ) = HrisBenefitIndividualUnenrollManyPageAsync(individualsService, params, response) } @NoAutoDetect @@ -149,17 +144,15 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitIndividualUnenrollManyPageAsync, - ) { + class AutoPager(private val firstPage: HrisBenefitIndividualUnenrollManyPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (UnenrolledIndividual) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -168,7 +161,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 30914a92..9994d336 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 @@ -24,7 +24,7 @@ import java.util.Optional class HrisBenefitIndividualUnenrollManyParams private constructor( private val benefitId: String, - private val body: HrisBenefitIndividualUnenrollManyBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -43,7 +43,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): HrisBenefitIndividualUnenrollManyBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -57,9 +57,9 @@ private constructor( } @NoAutoDetect - class HrisBenefitIndividualUnenrollManyBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("individual_ids") @ExcludeMissing private val individualIds: JsonField> = JsonMissing.of(), @@ -82,7 +82,7 @@ private constructor( private var validated: Boolean = false - fun validate(): HrisBenefitIndividualUnenrollManyBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -98,20 +98,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [HrisBenefitIndividualUnenrollManyBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var individualIds: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - hrisBenefitIndividualUnenrollManyBody: HrisBenefitIndividualUnenrollManyBody - ) = apply { - individualIds = - hrisBenefitIndividualUnenrollManyBody.individualIds.map { it.toMutableList() } - additionalProperties = - hrisBenefitIndividualUnenrollManyBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + individualIds = body.individualIds.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } /** Array of individual_ids to unenroll. */ @@ -156,10 +152,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): HrisBenefitIndividualUnenrollManyBody = - HrisBenefitIndividualUnenrollManyBody( + fun build(): Body = + Body( (individualIds ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -168,7 +164,7 @@ private constructor( return true } - return /* spotless:off */ other is HrisBenefitIndividualUnenrollManyBody && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && individualIds == other.individualIds && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -178,7 +174,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "HrisBenefitIndividualUnenrollManyBody{individualIds=$individualIds, additionalProperties=$additionalProperties}" + "Body{individualIds=$individualIds, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -193,8 +189,7 @@ private constructor( class Builder internal constructor() { private var benefitId: String? = null - private var body: HrisBenefitIndividualUnenrollManyBody.Builder = - HrisBenefitIndividualUnenrollManyBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 dcfd510d..b2a4c5d6 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 @@ -62,11 +62,7 @@ private constructor( @JvmStatic fun of(benefitsService: BenefitService, params: HrisBenefitListParams, response: Response) = - HrisBenefitListPage( - benefitsService, - params, - response, - ) + HrisBenefitListPage(benefitsService, params, response) } @NoAutoDetect @@ -142,9 +138,7 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitListPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisBenefitListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 600505e0..fcd50f1f 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 @@ -67,13 +67,8 @@ private constructor( fun of( benefitsService: BenefitServiceAsync, params: HrisBenefitListParams, - response: Response - ) = - HrisBenefitListPageAsync( - benefitsService, - params, - response, - ) + response: Response, + ) = HrisBenefitListPageAsync(benefitsService, params, response) } @NoAutoDetect @@ -149,17 +144,15 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitListPageAsync, - ) { + class AutoPager(private val firstPage: HrisBenefitListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (CompanyBenefit) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -168,7 +161,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 25e77547..5e65cc88 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 @@ -64,13 +64,8 @@ private constructor( fun of( benefitsService: BenefitService, params: HrisBenefitListSupportedBenefitsParams, - response: Response - ) = - HrisBenefitListSupportedBenefitsPage( - benefitsService, - params, - response, - ) + response: Response, + ) = HrisBenefitListSupportedBenefitsPage(benefitsService, params, response) } @NoAutoDetect @@ -146,9 +141,8 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitListSupportedBenefitsPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisBenefitListSupportedBenefitsPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 add12868..e21eb7f7 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 @@ -67,13 +67,8 @@ private constructor( fun of( benefitsService: BenefitServiceAsync, params: HrisBenefitListSupportedBenefitsParams, - response: Response - ) = - HrisBenefitListSupportedBenefitsPageAsync( - benefitsService, - params, - response, - ) + response: Response, + ) = HrisBenefitListSupportedBenefitsPageAsync(benefitsService, params, response) } @NoAutoDetect @@ -149,17 +144,15 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisBenefitListSupportedBenefitsPageAsync, - ) { + class AutoPager(private val firstPage: HrisBenefitListSupportedBenefitsPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (SupportedBenefit) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -168,7 +161,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 a5393797..0719a212 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 @@ -147,7 +147,7 @@ private constructor( fun build(): HrisBenefitListSupportedBenefitsParams = HrisBenefitListSupportedBenefitsParams( additionalHeaders.build(), - additionalQueryParams.build() + additionalQueryParams.build(), ) } 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 208bf30c..f3e83adb 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 @@ -24,7 +24,7 @@ import java.util.Optional class HrisBenefitUpdateParams private constructor( private val benefitId: String, - private val body: HrisBenefitUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -43,7 +43,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): HrisBenefitUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -57,9 +57,9 @@ private constructor( } @NoAutoDetect - class HrisBenefitUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("description") @ExcludeMissing private val description: JsonField = JsonMissing.of(), @@ -82,7 +82,7 @@ private constructor( private var validated: Boolean = false - fun validate(): HrisBenefitUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -98,16 +98,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [HrisBenefitUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var description: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(hrisBenefitUpdateBody: HrisBenefitUpdateBody) = apply { - description = hrisBenefitUpdateBody.description - additionalProperties = hrisBenefitUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + description = body.description + additionalProperties = body.additionalProperties.toMutableMap() } /** Updated name or description. */ @@ -137,8 +137,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): HrisBenefitUpdateBody = - HrisBenefitUpdateBody(description, additionalProperties.toImmutable()) + fun build(): Body = Body(description, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -146,7 +145,7 @@ private constructor( return true } - return /* spotless:off */ other is HrisBenefitUpdateBody && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -156,7 +155,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "HrisBenefitUpdateBody{description=$description, additionalProperties=$additionalProperties}" + "Body{description=$description, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -171,7 +170,7 @@ private constructor( class Builder internal constructor() { private var benefitId: String? = null - private var body: HrisBenefitUpdateBody.Builder = HrisBenefitUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 5c83291a..4b994a9e 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 @@ -81,13 +81,8 @@ private constructor( fun of( directoryService: DirectoryService, params: HrisDirectoryListIndividualsParams, - response: Response - ) = - HrisDirectoryListIndividualsPage( - directoryService, - params, - response, - ) + response: Response, + ) = HrisDirectoryListIndividualsPage(directoryService, params, response) } @NoAutoDetect @@ -177,18 +172,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - individuals, - paging, - additionalProperties.toImmutable(), - ) + fun build() = Response(individuals, paging, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: HrisDirectoryListIndividualsPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisDirectoryListIndividualsPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 e516e91e..ca3201d0 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 @@ -84,13 +84,8 @@ private constructor( fun of( directoryService: DirectoryServiceAsync, params: HrisDirectoryListIndividualsParams, - response: Response - ) = - HrisDirectoryListIndividualsPageAsync( - directoryService, - params, - response, - ) + response: Response, + ) = HrisDirectoryListIndividualsPageAsync(directoryService, params, response) } @NoAutoDetect @@ -180,26 +175,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - individuals, - paging, - additionalProperties.toImmutable(), - ) + fun build() = Response(individuals, paging, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: HrisDirectoryListIndividualsPageAsync, - ) { + class AutoPager(private val firstPage: HrisDirectoryListIndividualsPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (IndividualInDirectory) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -208,7 +196,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 1eb5dec5..4a31c2c6 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 @@ -80,13 +80,8 @@ private constructor( fun of( directoryService: DirectoryService, params: HrisDirectoryListParams, - response: Response - ) = - HrisDirectoryListPage( - directoryService, - params, - response, - ) + response: Response, + ) = HrisDirectoryListPage(directoryService, params, response) } @NoAutoDetect @@ -176,18 +171,12 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - individuals, - paging, - additionalProperties.toImmutable(), - ) + fun build() = Response(individuals, paging, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: HrisDirectoryListPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisDirectoryListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 a46ebda5..861ffde7 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 @@ -83,13 +83,8 @@ private constructor( fun of( directoryService: DirectoryServiceAsync, params: HrisDirectoryListParams, - response: Response - ) = - HrisDirectoryListPageAsync( - directoryService, - params, - response, - ) + response: Response, + ) = HrisDirectoryListPageAsync(directoryService, params, response) } @NoAutoDetect @@ -179,26 +174,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - individuals, - paging, - additionalProperties.toImmutable(), - ) + fun build() = Response(individuals, paging, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: HrisDirectoryListPageAsync, - ) { + class AutoPager(private val firstPage: HrisDirectoryListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (IndividualInDirectory) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -207,7 +195,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 6d13fc3b..28c06a6a 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 @@ -245,11 +245,7 @@ private constructor( ) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -321,7 +317,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { 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 1ef955e2..fb7c68c0 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 @@ -64,13 +64,8 @@ private constructor( fun of( employmentsService: EmploymentService, params: HrisEmploymentRetrieveManyParams, - response: Response - ) = - HrisEmploymentRetrieveManyPage( - employmentsService, - params, - response, - ) + response: Response, + ) = HrisEmploymentRetrieveManyPage(employmentsService, params, response) } @NoAutoDetect @@ -151,9 +146,8 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisEmploymentRetrieveManyPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisEmploymentRetrieveManyPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 f3dc9330..16233a7b 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 @@ -67,13 +67,8 @@ private constructor( fun of( employmentsService: EmploymentServiceAsync, params: HrisEmploymentRetrieveManyParams, - response: Response - ) = - HrisEmploymentRetrieveManyPageAsync( - employmentsService, - params, - response, - ) + response: Response, + ) = HrisEmploymentRetrieveManyPageAsync(employmentsService, params, response) } @NoAutoDetect @@ -154,17 +149,15 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisEmploymentRetrieveManyPageAsync, - ) { + class AutoPager(private val firstPage: HrisEmploymentRetrieveManyPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (EmploymentDataResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -173,7 +166,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 47a1156c..7dc8e0fa 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 @@ -22,7 +22,7 @@ import java.util.Objects /** Read individual employment and income data */ class HrisEmploymentRetrieveManyParams private constructor( - private val body: HrisEmploymentRetrieveManyBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -39,7 +39,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): HrisEmploymentRetrieveManyBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -47,9 +47,9 @@ private constructor( /** Individual Ids Request Body */ @NoAutoDetect - class HrisEmploymentRetrieveManyBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("requests") @ExcludeMissing private val requests: JsonField> = JsonMissing.of(), @@ -71,7 +71,7 @@ private constructor( private var validated: Boolean = false - fun validate(): HrisEmploymentRetrieveManyBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -87,19 +87,17 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [HrisEmploymentRetrieveManyBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var requests: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(hrisEmploymentRetrieveManyBody: HrisEmploymentRetrieveManyBody) = - apply { - requests = hrisEmploymentRetrieveManyBody.requests.map { it.toMutableList() } - additionalProperties = - hrisEmploymentRetrieveManyBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + requests = body.requests.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } /** The array of batch requests. */ fun requests(requests: List) = requests(JsonField.of(requests)) @@ -142,10 +140,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): HrisEmploymentRetrieveManyBody = - HrisEmploymentRetrieveManyBody( + fun build(): Body = + Body( checkRequired("requests", requests).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -154,7 +152,7 @@ private constructor( return true } - return /* spotless:off */ other is HrisEmploymentRetrieveManyBody && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -164,7 +162,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "HrisEmploymentRetrieveManyBody{requests=$requests, additionalProperties=$additionalProperties}" + "Body{requests=$requests, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -178,8 +176,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: HrisEmploymentRetrieveManyBody.Builder = - HrisEmploymentRetrieveManyBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -425,7 +422,7 @@ private constructor( fun build(): Request = Request( checkRequired("individualId", individualId), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 30c5ab22..580aacb5 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 @@ -64,13 +64,8 @@ private constructor( fun of( individualsService: IndividualService, params: HrisIndividualRetrieveManyParams, - response: Response - ) = - HrisIndividualRetrieveManyPage( - individualsService, - params, - response, - ) + response: Response, + ) = HrisIndividualRetrieveManyPage(individualsService, params, response) } @NoAutoDetect @@ -149,9 +144,8 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisIndividualRetrieveManyPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisIndividualRetrieveManyPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 62e2a9c6..8693075d 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 @@ -67,13 +67,8 @@ private constructor( fun of( individualsService: IndividualServiceAsync, params: HrisIndividualRetrieveManyParams, - response: Response - ) = - HrisIndividualRetrieveManyPageAsync( - individualsService, - params, - response, - ) + response: Response, + ) = HrisIndividualRetrieveManyPageAsync(individualsService, params, response) } @NoAutoDetect @@ -152,17 +147,15 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisIndividualRetrieveManyPageAsync, - ) { + class AutoPager(private val firstPage: HrisIndividualRetrieveManyPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (IndividualResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -171,7 +164,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 c63cd80a..e65280f8 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 @@ -22,7 +22,7 @@ import java.util.Optional /** Read individual data, excluding income and employment data */ class HrisIndividualRetrieveManyParams private constructor( - private val body: HrisIndividualRetrieveManyBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -41,16 +41,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): HrisIndividualRetrieveManyBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class HrisIndividualRetrieveManyBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("options") @ExcludeMissing private val options: JsonField = JsonMissing.of(), @@ -78,7 +78,7 @@ private constructor( private var validated: Boolean = false - fun validate(): HrisIndividualRetrieveManyBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -95,7 +95,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [HrisIndividualRetrieveManyBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var options: JsonField = JsonMissing.of() @@ -103,13 +103,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(hrisIndividualRetrieveManyBody: HrisIndividualRetrieveManyBody) = - apply { - options = hrisIndividualRetrieveManyBody.options - requests = hrisIndividualRetrieveManyBody.requests.map { it.toMutableList() } - additionalProperties = - hrisIndividualRetrieveManyBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + options = body.options + requests = body.requests.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } fun options(options: Options?) = options(JsonField.ofNullable(options)) @@ -155,8 +153,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): HrisIndividualRetrieveManyBody = - HrisIndividualRetrieveManyBody( + fun build(): Body = + Body( options, (requests ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toImmutable(), @@ -168,7 +166,7 @@ private constructor( return true } - return /* spotless:off */ other is HrisIndividualRetrieveManyBody && options == other.options && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && options == other.options && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -178,7 +176,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "HrisIndividualRetrieveManyBody{options=$options, requests=$requests, additionalProperties=$additionalProperties}" + "Body{options=$options, requests=$requests, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -192,8 +190,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: HrisIndividualRetrieveManyBody.Builder = - HrisIndividualRetrieveManyBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -433,7 +430,7 @@ private constructor( fun build(): Options = Options( (include ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } 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 3343773b..6e8a850e 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 @@ -68,13 +68,8 @@ private constructor( fun of( payStatementsService: PayStatementService, params: HrisPayStatementRetrieveManyParams, - response: Response - ) = - HrisPayStatementRetrieveManyPage( - payStatementsService, - params, - response, - ) + response: Response, + ) = HrisPayStatementRetrieveManyPage(payStatementsService, params, response) } @NoAutoDetect @@ -154,9 +149,8 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisPayStatementRetrieveManyPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisPayStatementRetrieveManyPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 8402cb89..e1e84e39 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 @@ -71,13 +71,8 @@ private constructor( fun of( payStatementsService: PayStatementServiceAsync, params: HrisPayStatementRetrieveManyParams, - response: Response - ) = - HrisPayStatementRetrieveManyPageAsync( - payStatementsService, - params, - response, - ) + response: Response, + ) = HrisPayStatementRetrieveManyPageAsync(payStatementsService, params, response) } @NoAutoDetect @@ -157,17 +152,15 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisPayStatementRetrieveManyPageAsync, - ) { + class AutoPager(private val firstPage: HrisPayStatementRetrieveManyPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (PayStatementResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -176,7 +169,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) 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 2bd05098..7bf49d28 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 @@ -27,7 +27,7 @@ import java.util.Optional */ class HrisPayStatementRetrieveManyParams private constructor( - private val body: HrisPayStatementRetrieveManyBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -44,16 +44,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): HrisPayStatementRetrieveManyBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class HrisPayStatementRetrieveManyBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("requests") @ExcludeMissing private val requests: JsonField> = JsonMissing.of(), @@ -75,7 +75,7 @@ private constructor( private var validated: Boolean = false - fun validate(): HrisPayStatementRetrieveManyBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -91,19 +91,17 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [HrisPayStatementRetrieveManyBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var requests: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(hrisPayStatementRetrieveManyBody: HrisPayStatementRetrieveManyBody) = - apply { - requests = hrisPayStatementRetrieveManyBody.requests.map { it.toMutableList() } - additionalProperties = - hrisPayStatementRetrieveManyBody.additionalProperties.toMutableMap() - } + internal fun from(body: Body) = apply { + requests = body.requests.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } /** The array of batch requests. */ fun requests(requests: List) = requests(JsonField.of(requests)) @@ -146,10 +144,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): HrisPayStatementRetrieveManyBody = - HrisPayStatementRetrieveManyBody( + fun build(): Body = + Body( checkRequired("requests", requests).map { it.toImmutable() }, - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } @@ -158,7 +156,7 @@ private constructor( return true } - return /* spotless:off */ other is HrisPayStatementRetrieveManyBody && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && requests == other.requests && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -168,7 +166,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "HrisPayStatementRetrieveManyBody{requests=$requests, additionalProperties=$additionalProperties}" + "Body{requests=$requests, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -182,8 +180,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: HrisPayStatementRetrieveManyBody.Builder = - HrisPayStatementRetrieveManyBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() 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 21e1d194..c321b38f 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 @@ -62,11 +62,7 @@ private constructor( @JvmStatic fun of(paymentsService: PaymentService, params: HrisPaymentListParams, response: Response) = - HrisPaymentListPage( - paymentsService, - params, - response, - ) + HrisPaymentListPage(paymentsService, params, response) } @NoAutoDetect @@ -141,9 +137,7 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisPaymentListPage, - ) : Iterable { + class AutoPager(private val firstPage: HrisPaymentListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage 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 90b5f23f..c2d3ad50 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 @@ -67,13 +67,8 @@ private constructor( fun of( paymentsService: PaymentServiceAsync, params: HrisPaymentListParams, - response: Response - ) = - HrisPaymentListPageAsync( - paymentsService, - params, - response, - ) + response: Response, + ) = HrisPaymentListPageAsync(paymentsService, params, response) } @NoAutoDetect @@ -148,14 +143,12 @@ private constructor( } } - class AutoPager( - private val firstPage: HrisPaymentListPageAsync, - ) { + class AutoPager(private val firstPage: HrisPaymentListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Payment) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -164,7 +157,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt index 28c6cfb7..b0cf2130 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Income.kt @@ -187,24 +187,14 @@ private constructor( } fun build(): Income = - Income( - amount, - currency, - effectiveDate, - unit, - additionalProperties.toImmutable(), - ) + Income(amount, currency, effectiveDate, unit, additionalProperties.toImmutable()) } /** * The income unit of payment. Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, * `bi_weekly`, `weekly`, `daily`, `hourly`, and `fixed`. */ - class Unit - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Unit @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -318,7 +308,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Unit: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt index b26b4aba..e2f8fcb0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Individual.kt @@ -511,19 +511,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Email = - Email( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -596,7 +587,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -630,11 +633,7 @@ private constructor( } /** The EEOC-defined ethnicity of the individual. */ - class Ethnicity - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Ethnicity @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -745,7 +744,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -761,11 +770,7 @@ private constructor( } /** The gender of the individual. */ - class Gender - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Gender @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -849,7 +854,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Gender: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -952,19 +967,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PhoneNumber = - PhoneNumber( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1037,7 +1043,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { 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 f0d60f8a..e760e125 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 @@ -119,12 +119,7 @@ private constructor( } fun build(): IndividualBenefit = - IndividualBenefit( - body, - code, - individualId, - additionalProperties.toImmutable(), - ) + IndividualBenefit(body, code, individualId, additionalProperties.toImmutable()) } @NoAutoDetect @@ -349,9 +344,7 @@ private constructor( /** Type for HSA contribution limit if the benefit is a HSA. */ class HsaContributionLimit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -429,7 +422,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown HsaContributionLimit: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt index c380b159..16e4a305 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualEvent.kt @@ -315,11 +315,7 @@ private constructor( "Data{individualId=$individualId, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -399,7 +395,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt index d4fb4462..c78a32ba 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualResponse.kt @@ -119,12 +119,7 @@ private constructor( } fun build(): IndividualResponse = - IndividualResponse( - body, - code, - individualId, - additionalProperties.toImmutable(), - ) + IndividualResponse(body, code, individualId, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt index d1864f48..cd046d07 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/IndividualUpdateResponse.kt @@ -511,19 +511,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Email = - Email( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -596,7 +587,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -630,11 +633,7 @@ private constructor( } /** The EEOC-defined ethnicity of the individual. */ - class Ethnicity - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Ethnicity @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -745,7 +744,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -761,11 +770,7 @@ private constructor( } /** The gender of the individual. */ - class Gender - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Gender @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -849,7 +854,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Gender: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -950,19 +965,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PhoneNumber = - PhoneNumber( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1035,7 +1041,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt index 16b78e12..d3ea4304 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Introspection.kt @@ -812,11 +812,7 @@ private constructor( } fun build(): ConnectionStatus = - ConnectionStatus( - message, - status, - additionalProperties.toImmutable(), - ) + ConnectionStatus(message, status, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -838,11 +834,7 @@ private constructor( } /** The type of authentication method. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -933,7 +925,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -967,11 +971,7 @@ private constructor( } /** The type of application associated with a token. */ - class ClientType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ClientType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1051,7 +1051,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ClientType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1156,11 +1166,7 @@ private constructor( } fun build(): ConnectionStatus = - ConnectionStatus( - message, - status, - additionalProperties.toImmutable(), - ) + ConnectionStatus(message, status, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1186,11 +1192,8 @@ private constructor( * - `provider` - connection to an external provider * - `finch` - finch-generated data. */ - class ConnectionType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class ConnectionType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1265,7 +1268,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown ConnectionType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt index 9e723312..187f04d1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedCreateParams.kt @@ -50,29 +50,27 @@ import kotlin.jvm.optionals.getOrNull */ class JobAutomatedCreateParams private constructor( - private val body: JobAutomatedCreateBody, + private val body: Body?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun dataSyncAll(): Optional = body.dataSyncAll() - - fun w4FormEmployeeSync(): Optional = body.w4FormEmployeeSync() + fun body(): Optional = Optional.ofNullable(body) fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): JobAutomatedCreateBody = body + @JvmSynthetic internal fun _body(): Optional = Optional.ofNullable(body) override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - @JsonDeserialize(using = JobAutomatedCreateBody.Deserializer::class) - @JsonSerialize(using = JobAutomatedCreateBody.Serializer::class) - class JobAutomatedCreateBody - internal constructor( + @JsonDeserialize(using = Body.Deserializer::class) + @JsonSerialize(using = Body.Serializer::class) + class Body + private constructor( private val dataSyncAll: DataSyncAll? = null, private val w4FormEmployeeSync: W4FormEmployeeSync? = null, private val _json: JsonValue? = null, @@ -102,40 +100,55 @@ private constructor( } } + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitDataSyncAll(dataSyncAll: DataSyncAll) { + dataSyncAll.validate() + } + + override fun visitW4FormEmployeeSync(w4FormEmployeeSync: W4FormEmployeeSync) { + w4FormEmployeeSync.validate() + } + } + ) + validated = true + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is JobAutomatedCreateBody && dataSyncAll == other.dataSyncAll && w4FormEmployeeSync == other.w4FormEmployeeSync /* spotless:on */ + return /* spotless:off */ other is Body && dataSyncAll == other.dataSyncAll && w4FormEmployeeSync == other.w4FormEmployeeSync /* spotless:on */ } override fun hashCode(): Int = /* spotless:off */ Objects.hash(dataSyncAll, w4FormEmployeeSync) /* spotless:on */ override fun toString(): String = when { - dataSyncAll != null -> "JobAutomatedCreateBody{dataSyncAll=$dataSyncAll}" - w4FormEmployeeSync != null -> - "JobAutomatedCreateBody{w4FormEmployeeSync=$w4FormEmployeeSync}" - _json != null -> "JobAutomatedCreateBody{_unknown=$_json}" - else -> throw IllegalStateException("Invalid JobAutomatedCreateBody") + dataSyncAll != null -> "Body{dataSyncAll=$dataSyncAll}" + w4FormEmployeeSync != null -> "Body{w4FormEmployeeSync=$w4FormEmployeeSync}" + _json != null -> "Body{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Body") } companion object { - @JvmStatic - fun ofDataSyncAll(dataSyncAll: DataSyncAll) = - JobAutomatedCreateBody(dataSyncAll = dataSyncAll) + @JvmStatic fun ofDataSyncAll(dataSyncAll: DataSyncAll) = Body(dataSyncAll = dataSyncAll) @JvmStatic fun ofW4FormEmployeeSync(w4FormEmployeeSync: W4FormEmployeeSync) = - JobAutomatedCreateBody(w4FormEmployeeSync = w4FormEmployeeSync) + Body(w4FormEmployeeSync = w4FormEmployeeSync) } - /** - * An interface that defines how to map each variant of [JobAutomatedCreateBody] to a value - * of type [T]. - */ + /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ interface Visitor { fun visitDataSyncAll(dataSyncAll: DataSyncAll): T @@ -143,566 +156,566 @@ private constructor( fun visitW4FormEmployeeSync(w4FormEmployeeSync: W4FormEmployeeSync): T /** - * Maps an unknown variant of [JobAutomatedCreateBody] to a value of type [T]. + * Maps an unknown variant of [Body] to a value of type [T]. * - * An instance of [JobAutomatedCreateBody] 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. + * 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 unknown(json: JsonValue?): T { - throw FinchInvalidDataException("Unknown JobAutomatedCreateBody: $json") + throw FinchInvalidDataException("Unknown Body: $json") } } - internal class Deserializer : - BaseDeserializer(JobAutomatedCreateBody::class) { + internal class Deserializer : BaseDeserializer(Body::class) { - override fun ObjectCodec.deserialize(node: JsonNode): JobAutomatedCreateBody { + override fun ObjectCodec.deserialize(node: JsonNode): Body { val json = JsonValue.fromJsonNode(node) val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() when (type) { "data_sync_all" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return JobAutomatedCreateBody(dataSyncAll = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Body(dataSyncAll = it, _json = json) + } } "w4_form_employee_sync" -> { - tryDeserialize(node, jacksonTypeRef())?.let { - return JobAutomatedCreateBody(w4FormEmployeeSync = it, _json = json) - } + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return Body(w4FormEmployeeSync = it, _json = json) + } } } - return JobAutomatedCreateBody(_json = json) + return Body(_json = json) } } - internal class Serializer : - BaseSerializer(JobAutomatedCreateBody::class) { + internal class Serializer : BaseSerializer(Body::class) { override fun serialize( - value: JobAutomatedCreateBody, + value: Body, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.dataSyncAll != null -> generator.writeObject(value.dataSyncAll) value.w4FormEmployeeSync != null -> generator.writeObject(value.w4FormEmployeeSync) value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid JobAutomatedCreateBody") + else -> throw IllegalStateException("Invalid Body") } } } - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [JobAutomatedCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: JobAutomatedCreateBody? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(jobAutomatedCreateParams: JobAutomatedCreateParams) = apply { - body = jobAutomatedCreateParams.body - additionalHeaders = jobAutomatedCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = jobAutomatedCreateParams.additionalQueryParams.toBuilder() - } - - fun forDataSyncAll(dataSyncAll: DataSyncAll) = apply { - body = JobAutomatedCreateBody.ofDataSyncAll(dataSyncAll) - } - fun forW4FormEmployeeSync(w4FormEmployeeSync: W4FormEmployeeSync) = apply { - body = JobAutomatedCreateBody.ofW4FormEmployeeSync(w4FormEmployeeSync) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } + @NoAutoDetect + class DataSyncAll + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } + /** The type of job to start. */ + fun type(): Type = type.getRequired("type") - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } + /** The type of job to start. */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } + private var validated: Boolean = false - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } + fun validate(): DataSyncAll = apply { + if (validated) { + return@apply + } - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } + type() + validated = true + } - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + fun toBuilder() = Builder().from(this) - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } + companion object { - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + @JvmStatic fun builder() = Builder() + } - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } + /** A builder for [DataSyncAll]. */ + class Builder internal constructor() { - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } + @JvmSynthetic + internal fun from(dataSyncAll: DataSyncAll) = apply { + type = dataSyncAll.type + additionalProperties = dataSyncAll.additionalProperties.toMutableMap() + } - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } + /** The type of job to start. */ + fun type(type: Type) = type(JsonField.of(type)) - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } + /** The type of job to start. */ + fun type(type: JsonField) = apply { this.type = type } - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + fun build(): DataSyncAll = + DataSyncAll(checkRequired("type", type), additionalProperties.toImmutable()) } - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun build(): JobAutomatedCreateParams = - JobAutomatedCreateParams( - body ?: JobAutomatedCreateBody(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - @NoAutoDetect - class DataSyncAll - @JsonCreator - private constructor( - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - /** The type of job to start. */ - fun type(): Type = type.getRequired("type") - - /** The type of job to start. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + /** The type of job to start. */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - private var validated: Boolean = false + companion object { - fun validate(): DataSyncAll = apply { - if (validated) { - return@apply - } + @JvmField val DATA_SYNC_ALL = of("data_sync_all") - type() - validated = true - } + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } - fun toBuilder() = Builder().from(this) + /** An enum containing [Type]'s known values. */ + enum class Known { + DATA_SYNC_ALL + } - companion object { + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DATA_SYNC_ALL, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } - @JvmStatic fun builder() = Builder() - } + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DATA_SYNC_ALL -> Value.DATA_SYNC_ALL + else -> Value._UNKNOWN + } - /** A builder for [DataSyncAll]. */ - class Builder internal constructor() { + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws FinchInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + DATA_SYNC_ALL -> Known.DATA_SYNC_ALL + else -> throw FinchInvalidDataException("Unknown Type: $value") + } - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } - @JvmSynthetic - internal fun from(dataSyncAll: DataSyncAll) = apply { - type = dataSyncAll.type - additionalProperties = dataSyncAll.additionalProperties.toMutableMap() - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - /** The type of job to start. */ - fun type(type: Type) = type(JsonField.of(type)) + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + } - /** The type of job to start. */ - fun type(type: JsonField) = apply { this.type = type } + override fun hashCode() = value.hashCode() - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + override fun toString() = value.toString() } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + return /* spotless:off */ other is DataSyncAll && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + /* spotless:on */ - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + override fun hashCode(): Int = hashCode - fun build(): DataSyncAll = - DataSyncAll(checkRequired("type", type), additionalProperties.toImmutable()) + override fun toString() = + "DataSyncAll{type=$type, additionalProperties=$additionalProperties}" } - /** The type of job to start. */ - class Type + @NoAutoDetect + class W4FormEmployeeSync @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { + @JsonProperty("params") + @ExcludeMissing + private val params: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + private val type: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - @JvmField val DATA_SYNC_ALL = of("data_sync_all") + fun params(): Params = params.getRequired("params") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - DATA_SYNC_ALL, - } + /** The type of job to start. */ + fun type(): Type = type.getRequired("type") - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DATA_SYNC_ALL, - /** An enum member indicating that [Type] was instantiated with an unknown value. */ - _UNKNOWN, - } + @JsonProperty("params") @ExcludeMissing fun _params(): JsonField = params - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DATA_SYNC_ALL -> Value.DATA_SYNC_ALL - else -> Value._UNKNOWN - } + /** The type of job to start. */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws FinchInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - DATA_SYNC_ALL -> Known.DATA_SYNC_ALL - else -> throw FinchInvalidDataException("Unknown Type: $value") - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - fun asString(): String = _value().asStringOrThrow() + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun validate(): W4FormEmployeeSync = apply { + if (validated) { + return@apply } - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ + params().validate() + type() + validated = true } - override fun hashCode() = value.hashCode() + fun toBuilder() = Builder().from(this) - override fun toString() = value.toString() - } + companion object { - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + @JvmStatic fun builder() = Builder() } - return /* spotless:off */ other is DataSyncAll && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ - } + /** A builder for [W4FormEmployeeSync]. */ + class Builder internal constructor() { - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } - /* spotless:on */ + private var params: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - override fun hashCode(): Int = hashCode + @JvmSynthetic + internal fun from(w4FormEmployeeSync: W4FormEmployeeSync) = apply { + params = w4FormEmployeeSync.params + type = w4FormEmployeeSync.type + additionalProperties = w4FormEmployeeSync.additionalProperties.toMutableMap() + } - override fun toString() = - "DataSyncAll{type=$type, additionalProperties=$additionalProperties}" - } + fun params(params: Params) = params(JsonField.of(params)) - @NoAutoDetect - class W4FormEmployeeSync - @JsonCreator - private constructor( - @JsonProperty("params") - @ExcludeMissing - private val params: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun params(params: JsonField) = apply { this.params = params } - fun params(): Params = params.getRequired("params") + /** The type of job to start. */ + fun type(type: Type) = type(JsonField.of(type)) - /** The type of job to start. */ - fun type(): Type = type.getRequired("type") + /** The type of job to start. */ + fun type(type: JsonField) = apply { this.type = type } - @JsonProperty("params") @ExcludeMissing fun _params(): JsonField = params + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** The type of job to start. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun validate(): W4FormEmployeeSync = apply { - if (validated) { - return@apply + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): W4FormEmployeeSync = + W4FormEmployeeSync( + checkRequired("params", params), + checkRequired("type", type), + additionalProperties.toImmutable(), + ) } - params().validate() - type() - validated = true - } + @NoAutoDetect + class Params + @JsonCreator + private constructor( + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { - fun toBuilder() = Builder().from(this) + /** The unique ID of the individual for W-4 data sync. */ + fun individualId(): String = individualId.getRequired("individual_id") - companion object { + /** The unique ID of the individual for W-4 data sync. */ + @JsonProperty("individual_id") + @ExcludeMissing + fun _individualId(): JsonField = individualId - @JvmStatic fun builder() = Builder() - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - /** A builder for [W4FormEmployeeSync]. */ - class Builder internal constructor() { + private var validated: Boolean = false - private var params: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + fun validate(): Params = apply { + if (validated) { + return@apply + } - @JvmSynthetic - internal fun from(w4FormEmployeeSync: W4FormEmployeeSync) = apply { - params = w4FormEmployeeSync.params - type = w4FormEmployeeSync.type - additionalProperties = w4FormEmployeeSync.additionalProperties.toMutableMap() - } + individualId() + validated = true + } - fun params(params: Params) = params(JsonField.of(params)) + fun toBuilder() = Builder().from(this) - fun params(params: JsonField) = apply { this.params = params } + companion object { - /** The type of job to start. */ - fun type(type: Type) = type(JsonField.of(type)) + @JvmStatic fun builder() = Builder() + } - /** The type of job to start. */ - fun type(type: JsonField) = apply { this.type = type } + /** A builder for [Params]. */ + class Builder internal constructor() { - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + private var individualId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + @JvmSynthetic + internal fun from(params: Params) = apply { + individualId = params.individualId + additionalProperties = params.additionalProperties.toMutableMap() + } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + /** The unique ID of the individual for W-4 data sync. */ + fun individualId(individualId: String) = + individualId(JsonField.of(individualId)) - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + /** The unique ID of the individual for W-4 data sync. */ + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - fun build(): W4FormEmployeeSync = - W4FormEmployeeSync( - checkRequired("params", params), - checkRequired("type", type), - additionalProperties.toImmutable(), - ) - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - @NoAutoDetect - class Params - @JsonCreator - private constructor( - @JsonProperty("individual_id") - @ExcludeMissing - private val individualId: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** The unique ID of the individual for W-4 data sync. */ - fun individualId(): String = individualId.getRequired("individual_id") + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - /** The unique ID of the individual for W-4 data sync. */ - @JsonProperty("individual_id") - @ExcludeMissing - fun _individualId(): JsonField = individualId + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun build(): Params = + Params( + checkRequired("individualId", individualId), + additionalProperties.toImmutable(), + ) + } - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): Params = apply { - if (validated) { - return@apply + return /* spotless:off */ other is Params && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ } - individualId() - validated = true - } + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(individualId, additionalProperties) } + /* spotless:on */ - fun toBuilder() = Builder().from(this) - - companion object { + override fun hashCode(): Int = hashCode - @JvmStatic fun builder() = Builder() + override fun toString() = + "Params{individualId=$individualId, additionalProperties=$additionalProperties}" } - /** A builder for [Params]. */ - class Builder internal constructor() { + /** The type of job to start. */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { - private var individualId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmSynthetic - internal fun from(params: Params) = apply { - individualId = params.individualId - additionalProperties = params.additionalProperties.toMutableMap() - } + companion object { - /** The unique ID of the individual for W-4 data sync. */ - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + @JvmField val W4_FORM_EMPLOYEE_SYNC = of("w4_form_employee_sync") - /** The unique ID of the individual for W-4 data sync. */ - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + /** An enum containing [Type]'s known values. */ + enum class Known { + W4_FORM_EMPLOYEE_SYNC } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + W4_FORM_EMPLOYEE_SYNC, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, } - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + W4_FORM_EMPLOYEE_SYNC -> Value.W4_FORM_EMPLOYEE_SYNC + else -> Value._UNKNOWN } - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws FinchInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + W4_FORM_EMPLOYEE_SYNC -> Known.W4_FORM_EMPLOYEE_SYNC + else -> throw FinchInvalidDataException("Unknown Type: $value") + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Type && value == other.value /* spotless:on */ } - fun build(): Params = - Params( - checkRequired("individualId", individualId), - additionalProperties.toImmutable() - ) + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { @@ -710,122 +723,161 @@ private constructor( return true } - return /* spotless:off */ other is Params && individualId == other.individualId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is W4FormEmployeeSync && params == other.params && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(individualId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(params, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Params{individualId=$individualId, additionalProperties=$additionalProperties}" + "W4FormEmployeeSync{params=$params, type=$type, additionalProperties=$additionalProperties}" } + } - /** The type of job to start. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + fun toBuilder() = Builder().from(this) - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + companion object { - companion object { + @JvmStatic fun builder() = Builder() + } - @JvmField val W4_FORM_EMPLOYEE_SYNC = of("w4_form_employee_sync") + /** A builder for [JobAutomatedCreateParams]. */ + @NoAutoDetect + class Builder internal constructor() { - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } + private var body: Body? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - /** An enum containing [Type]'s known values. */ - enum class Known { - W4_FORM_EMPLOYEE_SYNC, - } + @JvmSynthetic + internal fun from(jobAutomatedCreateParams: JobAutomatedCreateParams) = apply { + body = jobAutomatedCreateParams.body + additionalHeaders = jobAutomatedCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = jobAutomatedCreateParams.additionalQueryParams.toBuilder() + } - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - W4_FORM_EMPLOYEE_SYNC, - /** An enum member indicating that [Type] was instantiated with an unknown value. */ - _UNKNOWN, - } + fun body(body: Body?) = apply { this.body = body } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - W4_FORM_EMPLOYEE_SYNC -> Value.W4_FORM_EMPLOYEE_SYNC - else -> Value._UNKNOWN - } + fun body(body: Optional) = body(body.orElse(null)) - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws FinchInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - W4_FORM_EMPLOYEE_SYNC -> Known.W4_FORM_EMPLOYEE_SYNC - else -> throw FinchInvalidDataException("Unknown Type: $value") - } + fun body(dataSyncAll: Body.DataSyncAll) = body(Body.ofDataSyncAll(dataSyncAll)) - fun asString(): String = _value().asStringOrThrow() + fun body(w4FormEmployeeSync: Body.W4FormEmployeeSync) = + body(Body.ofW4FormEmployeeSync(w4FormEmployeeSync)) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun w4FormEmployeeSyncBody(params: Body.W4FormEmployeeSync.Params) = + body( + Body.W4FormEmployeeSync.builder() + .type( + JobAutomatedCreateParams.Body.W4FormEmployeeSync.Type.W4_FORM_EMPLOYEE_SYNC + ) + .params(params) + .build() + ) - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - override fun hashCode() = value.hashCode() + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } - override fun toString() = value.toString() + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) } - return /* spotless:off */ other is W4FormEmployeeSync && params == other.params && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) } - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(params, type, additionalProperties) } - /* spotless:on */ + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } - override fun hashCode(): Int = hashCode + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - override fun toString() = - "W4FormEmployeeSync{params=$params, type=$type, additionalProperties=$additionalProperties}" + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun build(): JobAutomatedCreateParams = + JobAutomatedCreateParams(body, additionalHeaders.build(), additionalQueryParams.build()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt index 23663d9a..3774d28b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPage.kt @@ -84,13 +84,8 @@ private constructor( fun of( automatedService: AutomatedService, params: JobAutomatedListParams, - response: Response - ) = - JobAutomatedListPage( - automatedService, - params, - response, - ) + response: Response, + ) = JobAutomatedListPage(automatedService, params, response) } @NoAutoDetect @@ -175,18 +170,11 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paging, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paging, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: JobAutomatedListPage, - ) : Iterable { + class AutoPager(private val firstPage: JobAutomatedListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt index a89d64a1..f2ba3f01 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobAutomatedListPageAsync.kt @@ -87,13 +87,8 @@ private constructor( fun of( automatedService: AutomatedServiceAsync, params: JobAutomatedListParams, - response: Response - ) = - JobAutomatedListPageAsync( - automatedService, - params, - response, - ) + response: Response, + ) = JobAutomatedListPageAsync(automatedService, params, response) } @NoAutoDetect @@ -178,26 +173,19 @@ private constructor( this.additionalProperties.put(key, value) } - fun build() = - Response( - data, - paging, - additionalProperties.toImmutable(), - ) + fun build() = Response(data, paging, additionalProperties.toImmutable()) } } - class AutoPager( - private val firstPage: JobAutomatedListPageAsync, - ) { + class AutoPager(private val firstPage: JobAutomatedListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (AutomatedAsyncJob) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -206,7 +194,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt index 0e35e6bf..59f91f23 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/JobCompletionEvent.kt @@ -333,11 +333,7 @@ private constructor( "Data{jobId=$jobId, jobUrl=$jobUrl, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -435,7 +431,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt index 42a27152..ded94816 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ManualAsyncJob.kt @@ -148,11 +148,7 @@ private constructor( ) } - class Status - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -236,7 +232,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Status: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt index 2aeaa697..547abdfa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Money.kt @@ -110,12 +110,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Money = - Money( - amount, - currency, - additionalProperties.toImmutable(), - ) + fun build(): Money = Money(amount, currency, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt index 7ff857eb..2cd1bc73 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupport.kt @@ -16,11 +16,8 @@ import com.tryfinch.api.errors.FinchInvalidDataException * - `client_access_only`: This behavior is supported by the provider, but only available to the * client and not to Finch */ -class OperationSupport -@JsonCreator -private constructor( - private val value: JsonField, -) : Enum { +class OperationSupport @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -105,7 +102,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown OperationSupport: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt index 28f0e217..56ac7c5f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/OperationSupportMatrix.kt @@ -274,13 +274,7 @@ private constructor( } fun build(): OperationSupportMatrix = - OperationSupportMatrix( - create, - delete, - read, - update, - additionalProperties.toImmutable(), - ) + OperationSupportMatrix(create, delete, read, update, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt index 7775b803..d75f67c8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Paging.kt @@ -105,12 +105,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Paging = - Paging( - count, - offset, - additionalProperties.toImmutable(), - ) + fun build(): Paging = Paging(count, offset, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt index 157209b2..55d23e26 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupListResponse.kt @@ -154,11 +154,8 @@ private constructor( ) } - class PayFrequency - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -274,7 +271,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown PayFrequency: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt index fbf23ba7..40f1c2b2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayGroupRetrieveResponse.kt @@ -185,11 +185,8 @@ private constructor( ) } - class PayFrequency - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -305,7 +302,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown PayFrequency: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt index d529522b..359f7437 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt @@ -379,6 +379,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -396,6 +399,9 @@ private constructor( /** The earnings amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The earnings currency code. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -414,6 +420,10 @@ private constructor( /** The earnings amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The earnings currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -441,6 +451,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() hours() name() @@ -459,6 +470,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var hours: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -468,6 +480,7 @@ private constructor( @JvmSynthetic internal fun from(earning: Earning) = apply { amount = earning.amount + attributes = earning.attributes currency = earning.currency hours = earning.hours name = earning.name @@ -488,6 +501,12 @@ private constructor( /** The earnings amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + /** The earnings currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -562,6 +581,7 @@ private constructor( fun build(): Earning = Earning( amount, + attributes, currency, hours, name, @@ -570,12 +590,213 @@ private constructor( ) } - /** The type of earning. */ - class Type + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + /** The type of earning. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -714,7 +935,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -734,17 +967,17 @@ private constructor( return true } - return /* spotless:off */ other is Earning && amount == other.amount && currency == other.currency && hours == other.hours && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Earning && amount == other.amount && attributes == other.attributes && currency == other.currency && hours == other.hours && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, hours, name, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, hours, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Earning{amount=$amount, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" + "Earning{amount=$amount, attributes=$attributes, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -754,6 +987,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -773,6 +1009,9 @@ private constructor( /** The deduction amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The deduction currency. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -788,6 +1027,10 @@ private constructor( /** The deduction amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The deduction currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -812,6 +1055,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() name() preTax() @@ -830,6 +1074,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var preTax: JsonField = JsonMissing.of() @@ -839,6 +1084,7 @@ private constructor( @JvmSynthetic internal fun from(employeeDeduction: EmployeeDeduction) = apply { amount = employeeDeduction.amount + attributes = employeeDeduction.attributes currency = employeeDeduction.currency name = employeeDeduction.name preTax = employeeDeduction.preTax @@ -859,6 +1105,12 @@ private constructor( /** The deduction amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + /** The deduction currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -921,6 +1173,7 @@ private constructor( fun build(): EmployeeDeduction = EmployeeDeduction( amount, + attributes, currency, name, preTax, @@ -929,22 +1182,227 @@ private constructor( ) } + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EmployeeDeduction && amount == other.amount && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployeeDeduction && amount == other.amount && attributes == other.attributes && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, name, preTax, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, name, preTax, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployeeDeduction{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" + "EmployeeDeduction{amount=$amount, attributes=$attributes, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -954,6 +1412,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -970,6 +1431,9 @@ private constructor( /** The contribution amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The contribution currency. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -982,6 +1446,10 @@ private constructor( /** The contribution amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The contribution currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1003,6 +1471,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() name() type() @@ -1020,6 +1489,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() @@ -1028,6 +1498,7 @@ private constructor( @JvmSynthetic internal fun from(employerContribution: EmployerContribution) = apply { amount = employerContribution.amount + attributes = employerContribution.attributes currency = employerContribution.currency name = employerContribution.name type = employerContribution.type @@ -1047,6 +1518,12 @@ private constructor( /** The contribution amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + /** The contribution currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1096,6 +1573,7 @@ private constructor( fun build(): EmployerContribution = EmployerContribution( amount, + attributes, currency, name, type, @@ -1103,30 +1581,232 @@ private constructor( ) } + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EmployerContribution && amount == other.amount && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployerContribution && amount == other.amount && attributes == other.attributes && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, name, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployerContribution{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" + "EmployerContribution{amount=$amount, attributes=$attributes, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" } /** The payment method. */ - class PaymentMethod - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PaymentMethod @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1201,7 +1881,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown PaymentMethod: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1223,6 +1913,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1240,6 +1933,9 @@ private constructor( /** The tax amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The currency code. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -1255,6 +1951,10 @@ private constructor( /** The tax amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1279,6 +1979,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() employer() name() @@ -1297,6 +1998,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var employer: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -1306,6 +2008,7 @@ private constructor( @JvmSynthetic internal fun from(tax: Tax) = apply { amount = tax.amount + attributes = tax.attributes currency = tax.currency employer = tax.employer name = tax.name @@ -1326,6 +2029,12 @@ private constructor( /** The tax amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { this.attributes = attributes } + /** The currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1388,6 +2097,7 @@ private constructor( fun build(): Tax = Tax( amount, + attributes, currency, employer, name, @@ -1396,12 +2106,213 @@ private constructor( ) } - /** The type of taxes. */ - class Type + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value pairs + * where the values can be of any type (string, number, boolean, object, array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + /** The type of taxes. */ + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1486,7 +2397,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1506,25 +2429,21 @@ private constructor( return true } - return /* spotless:off */ other is Tax && amount == other.amount && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tax && amount == other.amount && attributes == other.attributes && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, employer, name, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, employer, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tax{amount=$amount, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" + "Tax{amount=$amount, attributes=$attributes, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" } /** The type of the payment associated with the pay statement. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1602,7 +2521,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt index 37ad59a8..79a6bd0a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementEvent.kt @@ -312,12 +312,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Data = - Data( - individualId, - paymentId, - additionalProperties.toImmutable(), - ) + fun build(): Data = Data(individualId, paymentId, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -338,11 +333,7 @@ private constructor( "Data{individualId=$individualId, paymentId=$paymentId, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -422,7 +413,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt index d2b73d6d..22aaf7fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementResponse.kt @@ -114,12 +114,7 @@ private constructor( } fun build(): PayStatementResponse = - PayStatementResponse( - body, - code, - paymentId, - additionalProperties.toImmutable(), - ) + PayStatementResponse(body, code, paymentId, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt index a98098da..bc5df509 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Payment.kt @@ -385,11 +385,8 @@ private constructor( ) } - class PayFrequency - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PayFrequency @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -505,7 +502,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown PayFrequency: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -612,11 +619,7 @@ private constructor( } fun build(): PayPeriod = - PayPeriod( - endDate, - startDate, - additionalProperties.toImmutable(), - ) + PayPeriod(endDate, startDate, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt index 020fc76d..dcd964b3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PaymentEvent.kt @@ -335,11 +335,7 @@ private constructor( "PaymentIdentifiers{payDate=$payDate, paymentId=$paymentId, additionalProperties=$additionalProperties}" } - class EventType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -419,7 +415,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EventType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index 51aa4989..aec5d816 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -64,13 +64,8 @@ private constructor( fun of( payGroupsService: PayGroupService, params: PayrollPayGroupListParams, - response: Response - ) = - PayrollPayGroupListPage( - payGroupsService, - params, - response, - ) + response: Response, + ) = PayrollPayGroupListPage(payGroupsService, params, response) } @NoAutoDetect @@ -146,9 +141,8 @@ private constructor( } } - class AutoPager( - private val firstPage: PayrollPayGroupListPage, - ) : Iterable { + class AutoPager(private val firstPage: PayrollPayGroupListPage) : + Iterable { override fun iterator(): Iterator = iterator { var page = firstPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index eb29f545..8e352508 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -67,13 +67,8 @@ private constructor( fun of( payGroupsService: PayGroupServiceAsync, params: PayrollPayGroupListParams, - response: Response - ) = - PayrollPayGroupListPageAsync( - payGroupsService, - params, - response, - ) + response: Response, + ) = PayrollPayGroupListPageAsync(payGroupsService, params, response) } @NoAutoDetect @@ -149,17 +144,15 @@ private constructor( } } - class AutoPager( - private val firstPage: PayrollPayGroupListPageAsync, - ) { + class AutoPager(private val firstPage: PayrollPayGroupListPageAsync) { fun forEach( action: Predicate, - executor: Executor + executor: Executor, ): CompletableFuture { fun CompletableFuture>.forEach( action: (PayGroupListResponse) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -168,7 +161,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt index 75479ec8..ea274b56 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/Provider.kt @@ -1213,11 +1213,7 @@ private constructor( } fun build(): Departments = - Departments( - name, - parent, - additionalProperties.toImmutable(), - ) + Departments(name, parent, additionalProperties.toImmutable()) } @NoAutoDetect @@ -1431,11 +1427,7 @@ private constructor( } fun build(): Entity = - Entity( - subtype, - type, - additionalProperties.toImmutable(), - ) + Entity(subtype, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -2173,11 +2165,7 @@ private constructor( } fun build(): Paging = - Paging( - count, - offset, - additionalProperties.toImmutable(), - ) + Paging(count, offset, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -2795,11 +2783,7 @@ private constructor( } fun build(): Employment = - Employment( - subtype, - type, - additionalProperties.toImmutable(), - ) + Employment(subtype, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -2933,12 +2917,7 @@ private constructor( } fun build(): Income = - Income( - amount, - currency, - unit, - additionalProperties.toImmutable(), - ) + Income(amount, currency, unit, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -3653,12 +3632,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Emails = - Emails( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): Emails = Emails(data, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -3770,11 +3744,7 @@ private constructor( } fun build(): PhoneNumbers = - PhoneNumbers( - data, - type, - additionalProperties.toImmutable(), - ) + PhoneNumbers(data, type, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -5733,11 +5703,7 @@ private constructor( } fun build(): PayPeriod = - PayPeriod( - endDate, - startDate, - additionalProperties.toImmutable(), - ) + PayPeriod(endDate, startDate, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -5795,11 +5761,7 @@ private constructor( } /** The type of authentication method. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5890,7 +5852,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 9d818def..3d4f3975 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -62,11 +62,7 @@ private constructor( @JvmStatic fun of(providersService: ProviderService, params: ProviderListParams, response: Response) = - ProviderListPage( - providersService, - params, - response, - ) + ProviderListPage(providersService, params, response) } @NoAutoDetect @@ -141,9 +137,7 @@ private constructor( } } - class AutoPager( - private val firstPage: ProviderListPage, - ) : Iterable { + class AutoPager(private val firstPage: ProviderListPage) : Iterable { override fun iterator(): Iterator = iterator { var page = firstPage diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index 92cdf968..37cf24fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -67,13 +67,8 @@ private constructor( fun of( providersService: ProviderServiceAsync, params: ProviderListParams, - response: Response - ) = - ProviderListPageAsync( - providersService, - params, - response, - ) + response: Response, + ) = ProviderListPageAsync(providersService, params, response) } @NoAutoDetect @@ -148,14 +143,12 @@ private constructor( } } - class AutoPager( - private val firstPage: ProviderListPageAsync, - ) { + class AutoPager(private val firstPage: ProviderListPageAsync) { fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( action: (Provider) -> Boolean, - executor: Executor + executor: Executor, ): CompletableFuture = thenComposeAsync( { page -> @@ -164,7 +157,7 @@ private constructor( .map { it.getNextPage().forEach(action, executor) } .orElseGet { CompletableFuture.completedFuture(null) } }, - executor + executor, ) return CompletableFuture.completedFuture(Optional.of(firstPage)) .forEach(action::test, executor) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt index 86d06978..7379952c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/RequestForwardingForwardParams.kt @@ -27,7 +27,7 @@ import java.util.Optional */ class RequestForwardingForwardParams private constructor( - private val body: RequestForwardingForwardBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -87,7 +87,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): RequestForwardingForwardBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -95,9 +95,9 @@ private constructor( /** Forward Request Body */ @NoAutoDetect - class RequestForwardingForwardBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("method") @ExcludeMissing private val method: JsonField = JsonMissing.of(), @@ -168,7 +168,7 @@ private constructor( private var validated: Boolean = false - fun validate(): RequestForwardingForwardBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -186,7 +186,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [RequestForwardingForwardBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var method: JsonField? = null @@ -197,14 +197,13 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(requestForwardingForwardBody: RequestForwardingForwardBody) = apply { - method = requestForwardingForwardBody.method - route = requestForwardingForwardBody.route - data = requestForwardingForwardBody.data - headers = requestForwardingForwardBody.headers - params = requestForwardingForwardBody.params - additionalProperties = - requestForwardingForwardBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + method = body.method + route = body.route + data = body.data + headers = body.headers + params = body.params + additionalProperties = body.additionalProperties.toMutableMap() } /** @@ -283,8 +282,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): RequestForwardingForwardBody = - RequestForwardingForwardBody( + fun build(): Body = + Body( checkRequired("method", method), checkRequired("route", route), data, @@ -299,7 +298,7 @@ private constructor( return true } - return /* spotless:off */ other is RequestForwardingForwardBody && method == other.method && route == other.route && data == other.data && headers == other.headers && params == other.params && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && method == other.method && route == other.route && data == other.data && headers == other.headers && params == other.params && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -309,7 +308,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RequestForwardingForwardBody{method=$method, route=$route, data=$data, headers=$headers, params=$params, additionalProperties=$additionalProperties}" + "Body{method=$method, route=$route, data=$data, headers=$headers, params=$params, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -323,8 +322,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: RequestForwardingForwardBody.Builder = - RequestForwardingForwardBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt index 1d725117..d4593243 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParams.kt @@ -25,7 +25,7 @@ import java.util.Optional /** Update a sandbox company's data */ class SandboxCompanyUpdateParams private constructor( - private val body: SandboxCompanyUpdateBody, + private val body: CompanyWithoutId, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -82,16 +82,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxCompanyUpdateBody = body + @JvmSynthetic internal fun _body(): CompanyWithoutId = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class SandboxCompanyUpdateBody + class CompanyWithoutId @JsonCreator - internal constructor( + private constructor( @JsonProperty("accounts") @ExcludeMissing private val accounts: JsonField> = JsonMissing.of(), @@ -185,7 +185,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxCompanyUpdateBody = apply { + fun validate(): CompanyWithoutId = apply { if (validated) { return@apply } @@ -208,7 +208,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxCompanyUpdateBody]. */ + /** A builder for [CompanyWithoutId]. */ class Builder internal constructor() { private var accounts: JsonField>? = null @@ -222,16 +222,16 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(sandboxCompanyUpdateBody: SandboxCompanyUpdateBody) = apply { - accounts = sandboxCompanyUpdateBody.accounts.map { it.toMutableList() } - departments = sandboxCompanyUpdateBody.departments.map { it.toMutableList() } - ein = sandboxCompanyUpdateBody.ein - entity = sandboxCompanyUpdateBody.entity - legalName = sandboxCompanyUpdateBody.legalName - locations = sandboxCompanyUpdateBody.locations.map { it.toMutableList() } - primaryEmail = sandboxCompanyUpdateBody.primaryEmail - primaryPhoneNumber = sandboxCompanyUpdateBody.primaryPhoneNumber - additionalProperties = sandboxCompanyUpdateBody.additionalProperties.toMutableMap() + internal fun from(companyWithoutId: CompanyWithoutId) = apply { + accounts = companyWithoutId.accounts.map { it.toMutableList() } + departments = companyWithoutId.departments.map { it.toMutableList() } + ein = companyWithoutId.ein + entity = companyWithoutId.entity + legalName = companyWithoutId.legalName + locations = companyWithoutId.locations.map { it.toMutableList() } + primaryEmail = companyWithoutId.primaryEmail + primaryPhoneNumber = companyWithoutId.primaryPhoneNumber + additionalProperties = companyWithoutId.additionalProperties.toMutableMap() } /** An array of bank account objects associated with the payroll/HRIS system. */ @@ -379,8 +379,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxCompanyUpdateBody = - SandboxCompanyUpdateBody( + fun build(): CompanyWithoutId = + CompanyWithoutId( checkRequired("accounts", accounts).map { it.toImmutable() }, checkRequired("departments", departments).map { it.toImmutable() }, checkRequired("ein", ein), @@ -398,7 +398,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxCompanyUpdateBody && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is CompanyWithoutId && accounts == other.accounts && departments == other.departments && ein == other.ein && entity == other.entity && legalName == other.legalName && locations == other.locations && primaryEmail == other.primaryEmail && primaryPhoneNumber == other.primaryPhoneNumber && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -408,7 +408,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxCompanyUpdateBody{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" + "CompanyWithoutId{accounts=$accounts, departments=$departments, ein=$ein, entity=$entity, legalName=$legalName, locations=$locations, primaryEmail=$primaryEmail, primaryPhoneNumber=$primaryPhoneNumber, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -422,7 +422,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxCompanyUpdateBody.Builder = SandboxCompanyUpdateBody.builder() + private var body: CompanyWithoutId.Builder = CompanyWithoutId.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -866,11 +866,8 @@ private constructor( } /** The type of bank account. */ - class AccountType - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class AccountType @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -946,7 +943,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AccountType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1079,12 +1088,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Department = - Department( - name, - parent, - additionalProperties.toImmutable(), - ) + fun build(): Department = Department(name, parent, additionalProperties.toImmutable()) } /** The parent department, if present. */ @@ -1308,20 +1312,12 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Entity = - Entity( - subtype, - type, - additionalProperties.toImmutable(), - ) + fun build(): Entity = Entity(subtype, type, additionalProperties.toImmutable()) } /** The tax payer subtype of the company. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1402,7 +1398,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1418,11 +1426,7 @@ private constructor( } /** The tax payer type of the company. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1525,7 +1529,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt index d212b752..e450d723 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParams.kt @@ -25,7 +25,7 @@ import java.util.Optional /** Create a new account for an existing connection (company/provider pair) */ class SandboxConnectionAccountCreateParams private constructor( - private val body: SandboxConnectionAccountCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -62,16 +62,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxConnectionAccountCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class SandboxConnectionAccountCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("company_id") @ExcludeMissing private val companyId: JsonField = JsonMissing.of(), @@ -128,7 +128,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxConnectionAccountCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -147,7 +147,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxConnectionAccountCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var companyId: JsonField? = null @@ -157,15 +157,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - sandboxConnectionAccountCreateBody: SandboxConnectionAccountCreateBody - ) = apply { - companyId = sandboxConnectionAccountCreateBody.companyId - providerId = sandboxConnectionAccountCreateBody.providerId - authenticationType = sandboxConnectionAccountCreateBody.authenticationType - products = sandboxConnectionAccountCreateBody.products.map { it.toMutableList() } - additionalProperties = - sandboxConnectionAccountCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + companyId = body.companyId + providerId = body.providerId + authenticationType = body.authenticationType + products = body.products.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } fun companyId(companyId: String) = companyId(JsonField.of(companyId)) @@ -235,8 +232,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxConnectionAccountCreateBody = - SandboxConnectionAccountCreateBody( + fun build(): Body = + Body( checkRequired("companyId", companyId), checkRequired("providerId", providerId), authenticationType, @@ -250,7 +247,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxConnectionAccountCreateBody && companyId == other.companyId && providerId == other.providerId && authenticationType == other.authenticationType && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && companyId == other.companyId && providerId == other.providerId && authenticationType == other.authenticationType && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -260,7 +257,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxConnectionAccountCreateBody{companyId=$companyId, providerId=$providerId, authenticationType=$authenticationType, products=$products, additionalProperties=$additionalProperties}" + "Body{companyId=$companyId, providerId=$providerId, authenticationType=$authenticationType, products=$products, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -274,8 +271,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxConnectionAccountCreateBody.Builder = - SandboxConnectionAccountCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -452,9 +448,7 @@ private constructor( class AuthenticationType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -541,7 +535,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt index 41bffb71..c487b917 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParams.kt @@ -25,7 +25,7 @@ import java.util.Optional */ class SandboxConnectionAccountUpdateParams private constructor( - private val body: SandboxConnectionAccountUpdateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -40,16 +40,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxConnectionAccountUpdateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class SandboxConnectionAccountUpdateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("connection_status") @ExcludeMissing private val connectionStatus: JsonField = JsonMissing.of(), @@ -70,7 +70,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxConnectionAccountUpdateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -86,19 +86,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxConnectionAccountUpdateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var connectionStatus: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from( - sandboxConnectionAccountUpdateBody: SandboxConnectionAccountUpdateBody - ) = apply { - connectionStatus = sandboxConnectionAccountUpdateBody.connectionStatus - additionalProperties = - sandboxConnectionAccountUpdateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + connectionStatus = body.connectionStatus + additionalProperties = body.additionalProperties.toMutableMap() } fun connectionStatus(connectionStatus: ConnectionStatusType) = @@ -127,11 +124,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxConnectionAccountUpdateBody = - SandboxConnectionAccountUpdateBody( - connectionStatus, - additionalProperties.toImmutable() - ) + fun build(): Body = Body(connectionStatus, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -139,7 +132,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxConnectionAccountUpdateBody && connectionStatus == other.connectionStatus && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && connectionStatus == other.connectionStatus && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -149,7 +142,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxConnectionAccountUpdateBody{connectionStatus=$connectionStatus, additionalProperties=$additionalProperties}" + "Body{connectionStatus=$connectionStatus, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -163,8 +156,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxConnectionAccountUpdateBody.Builder = - SandboxConnectionAccountUpdateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt index 9201ae74..cf3c8589 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParams.kt @@ -25,7 +25,7 @@ import java.util.Optional /** Create a new connection (new company/provider pair) with a new account */ class SandboxConnectionCreateParams private constructor( - private val body: SandboxConnectionCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -64,16 +64,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxConnectionCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class SandboxConnectionCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("provider_id") @ExcludeMissing private val providerId: JsonField = JsonMissing.of(), @@ -135,7 +135,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxConnectionCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -154,7 +154,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxConnectionCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var providerId: JsonField? = null @@ -164,13 +164,12 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(sandboxConnectionCreateBody: SandboxConnectionCreateBody) = apply { - providerId = sandboxConnectionCreateBody.providerId - authenticationType = sandboxConnectionCreateBody.authenticationType - employeeSize = sandboxConnectionCreateBody.employeeSize - products = sandboxConnectionCreateBody.products.map { it.toMutableList() } - additionalProperties = - sandboxConnectionCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + providerId = body.providerId + authenticationType = body.authenticationType + employeeSize = body.employeeSize + products = body.products.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() } /** The provider associated with the connection */ @@ -240,8 +239,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxConnectionCreateBody = - SandboxConnectionCreateBody( + fun build(): Body = + Body( checkRequired("providerId", providerId), authenticationType, employeeSize, @@ -255,7 +254,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxConnectionCreateBody && providerId == other.providerId && authenticationType == other.authenticationType && employeeSize == other.employeeSize && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && providerId == other.providerId && authenticationType == other.authenticationType && employeeSize == other.employeeSize && products == other.products && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -265,7 +264,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxConnectionCreateBody{providerId=$providerId, authenticationType=$authenticationType, employeeSize=$employeeSize, products=$products, additionalProperties=$additionalProperties}" + "Body{providerId=$providerId, authenticationType=$authenticationType, employeeSize=$employeeSize, products=$products, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -279,8 +278,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxConnectionCreateBody.Builder = - SandboxConnectionCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -452,9 +450,7 @@ private constructor( class AuthenticationType @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -541,7 +537,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown AuthenticationType: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt index da8089a4..69d1eaeb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParams.kt @@ -13,7 +13,6 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.NoAutoDetect import com.tryfinch.api.core.Params -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.immutableEmptyMap @@ -25,7 +24,7 @@ import java.util.Optional /** Add new individuals to a sandbox company */ class SandboxDirectoryCreateParams private constructor( - private val body: List, + private val body: List?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -34,160 +33,19 @@ private constructor( * Array of individuals to create. Takes all combined fields from `/individual` and * `/employment` endpoints. All fields are optional. */ - fun body(): List = body + fun body(): Optional> = Optional.ofNullable(body) fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): List = body + @JvmSynthetic + internal fun _body(): Optional> = Optional.ofNullable(body) override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SandboxDirectoryCreateParams]. */ - @NoAutoDetect - class Builder internal constructor() { - - private var body: MutableList? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sandboxDirectoryCreateParams: SandboxDirectoryCreateParams) = apply { - body = sandboxDirectoryCreateParams.body.toMutableList() - additionalHeaders = sandboxDirectoryCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = sandboxDirectoryCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Array of individuals to create. Takes all combined fields from `/individual` and - * `/employment` endpoints. All fields are optional. - */ - fun body(body: List) = apply { this.body = body.toMutableList() } - - /** - * Array of individuals to create. Takes all combined fields from `/individual` and - * `/employment` endpoints. All fields are optional. - */ - fun addBody(body: IndividualOrEmployment) = apply { - this.body = (this.body ?: mutableListOf()).apply { add(body) } - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun build(): SandboxDirectoryCreateParams = - SandboxDirectoryCreateParams( - checkRequired("body", body).toImmutable(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - @NoAutoDetect class IndividualOrEmployment @JsonCreator @@ -269,8 +127,6 @@ private constructor( @JsonProperty("title") @ExcludeMissing private val title: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), ) { /** Worker's compensation classification code for this employee */ @@ -483,10 +339,6 @@ private constructor( /** The current title of the individual. */ @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - private var validated: Boolean = false fun validate(): IndividualOrEmployment = apply { @@ -561,7 +413,6 @@ private constructor( private var ssn: JsonField = JsonMissing.of() private var startDate: JsonField = JsonMissing.of() private var title: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(individualOrEmployment: IndividualOrEmployment) = apply { @@ -592,7 +443,6 @@ private constructor( ssn = individualOrEmployment.ssn startDate = individualOrEmployment.startDate title = individualOrEmployment.title - additionalProperties = individualOrEmployment.additionalProperties.toMutableMap() } /** Worker's compensation classification code for this employee */ @@ -944,25 +794,6 @@ private constructor( /** The current title of the individual. */ fun title(title: JsonField) = apply { this.title = title } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - fun build(): IndividualOrEmployment = IndividualOrEmployment( classCode, @@ -992,7 +823,6 @@ private constructor( ssn, startDate, title, - additionalProperties.toImmutable(), ) } @@ -1081,11 +911,7 @@ private constructor( } fun build(): CustomField = - CustomField( - name, - value, - additionalProperties.toImmutable(), - ) + CustomField(name, value, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1301,19 +1127,11 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Email = - Email( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1388,7 +1206,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1541,22 +1371,15 @@ private constructor( } fun build(): Employment = - Employment( - subtype, - type, - additionalProperties.toImmutable(), - ) + Employment(subtype, type, additionalProperties.toImmutable()) } /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1656,7 +1479,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1672,11 +1507,8 @@ private constructor( } /** The main employment type of the individual. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1751,7 +1583,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1787,9 +1631,7 @@ private constructor( /** The detailed employment status of the individual. */ class EmploymentStatus @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1896,7 +1738,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EmploymentStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1912,11 +1766,8 @@ private constructor( } /** The EEOC-defined ethnicity of the individual. */ - class Ethnicity - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Ethnicity @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2030,7 +1881,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2046,11 +1909,7 @@ private constructor( } /** The gender of the individual. */ - class Gender - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Gender @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -2137,7 +1996,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Gender: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2344,18 +2215,11 @@ private constructor( } fun build(): PhoneNumber = - PhoneNumber( - data, - type, - additionalProperties.toImmutable(), - ) + PhoneNumber(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -2430,7 +2294,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2468,17 +2344,165 @@ private constructor( return true } - return /* spotless:off */ other is IndividualOrEmployment && classCode == other.classCode && customFields == other.customFields && department == other.department && dob == other.dob && emails == other.emails && employment == other.employment && employmentStatus == other.employmentStatus && encryptedSsn == other.encryptedSsn && endDate == other.endDate && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && sourceId == other.sourceId && ssn == other.ssn && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualOrEmployment && classCode == other.classCode && customFields == other.customFields && department == other.department && dob == other.dob && emails == other.emails && employment == other.employment && employmentStatus == other.employmentStatus && encryptedSsn == other.encryptedSsn && endDate == other.endDate && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && sourceId == other.sourceId && ssn == other.ssn && startDate == other.startDate && title == other.title /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(classCode, customFields, department, dob, emails, employment, employmentStatus, encryptedSsn, endDate, ethnicity, firstName, gender, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, phoneNumbers, preferredName, residence, sourceId, ssn, startDate, title, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(classCode, customFields, department, dob, emails, employment, employmentStatus, encryptedSsn, endDate, ethnicity, firstName, gender, income, incomeHistory, isActive, lastName, latestRehireDate, location, manager, middleName, phoneNumbers, preferredName, residence, sourceId, ssn, startDate, title) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "IndividualOrEmployment{classCode=$classCode, customFields=$customFields, department=$department, dob=$dob, emails=$emails, employment=$employment, employmentStatus=$employmentStatus, encryptedSsn=$encryptedSsn, endDate=$endDate, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, sourceId=$sourceId, ssn=$ssn, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" + "IndividualOrEmployment{classCode=$classCode, customFields=$customFields, department=$department, dob=$dob, emails=$emails, employment=$employment, employmentStatus=$employmentStatus, encryptedSsn=$encryptedSsn, endDate=$endDate, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, sourceId=$sourceId, ssn=$ssn, startDate=$startDate, title=$title}" + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SandboxDirectoryCreateParams]. */ + @NoAutoDetect + class Builder internal constructor() { + + private var body: MutableList? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(sandboxDirectoryCreateParams: SandboxDirectoryCreateParams) = apply { + body = sandboxDirectoryCreateParams.body?.toMutableList() + additionalHeaders = sandboxDirectoryCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = sandboxDirectoryCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + fun body(body: List?) = apply { this.body = body?.toMutableList() } + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + fun body(body: Optional>) = body(body.orElse(null)) + + /** + * Array of individuals to create. Takes all combined fields from `/individual` and + * `/employment` endpoints. All fields are optional. + */ + fun addBody(body: IndividualOrEmployment) = apply { + this.body = (this.body ?: mutableListOf()).apply { add(body) } + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun build(): SandboxDirectoryCreateParams = + SandboxDirectoryCreateParams( + body?.toImmutable(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt index 251c39f9..0eee4350 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParams.kt @@ -26,7 +26,7 @@ import java.util.Optional class SandboxEmploymentUpdateParams private constructor( private val individualId: String, - private val body: SandboxEmploymentUpdateBody, + private val body: EmploymentWithoutId, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -153,7 +153,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxEmploymentUpdateBody = body + @JvmSynthetic internal fun _body(): EmploymentWithoutId = body override fun _headers(): Headers = additionalHeaders @@ -167,9 +167,9 @@ private constructor( } @NoAutoDetect - class SandboxEmploymentUpdateBody + class EmploymentWithoutId @JsonCreator - internal constructor( + private constructor( @JsonProperty("class_code") @ExcludeMissing private val classCode: JsonField = JsonMissing.of(), @@ -369,7 +369,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxEmploymentUpdateBody = apply { + fun validate(): EmploymentWithoutId = apply { if (validated) { return@apply } @@ -402,7 +402,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxEmploymentUpdateBody]. */ + /** A builder for [EmploymentWithoutId]. */ class Builder internal constructor() { private var classCode: JsonField = JsonMissing.of() @@ -426,27 +426,26 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(sandboxEmploymentUpdateBody: SandboxEmploymentUpdateBody) = apply { - classCode = sandboxEmploymentUpdateBody.classCode - customFields = sandboxEmploymentUpdateBody.customFields.map { it.toMutableList() } - department = sandboxEmploymentUpdateBody.department - employment = sandboxEmploymentUpdateBody.employment - employmentStatus = sandboxEmploymentUpdateBody.employmentStatus - endDate = sandboxEmploymentUpdateBody.endDate - firstName = sandboxEmploymentUpdateBody.firstName - income = sandboxEmploymentUpdateBody.income - incomeHistory = sandboxEmploymentUpdateBody.incomeHistory.map { it.toMutableList() } - isActive = sandboxEmploymentUpdateBody.isActive - lastName = sandboxEmploymentUpdateBody.lastName - latestRehireDate = sandboxEmploymentUpdateBody.latestRehireDate - location = sandboxEmploymentUpdateBody.location - manager = sandboxEmploymentUpdateBody.manager - middleName = sandboxEmploymentUpdateBody.middleName - sourceId = sandboxEmploymentUpdateBody.sourceId - startDate = sandboxEmploymentUpdateBody.startDate - title = sandboxEmploymentUpdateBody.title - additionalProperties = - sandboxEmploymentUpdateBody.additionalProperties.toMutableMap() + internal fun from(employmentWithoutId: EmploymentWithoutId) = apply { + classCode = employmentWithoutId.classCode + customFields = employmentWithoutId.customFields.map { it.toMutableList() } + department = employmentWithoutId.department + employment = employmentWithoutId.employment + employmentStatus = employmentWithoutId.employmentStatus + endDate = employmentWithoutId.endDate + firstName = employmentWithoutId.firstName + income = employmentWithoutId.income + incomeHistory = employmentWithoutId.incomeHistory.map { it.toMutableList() } + isActive = employmentWithoutId.isActive + lastName = employmentWithoutId.lastName + latestRehireDate = employmentWithoutId.latestRehireDate + location = employmentWithoutId.location + manager = employmentWithoutId.manager + middleName = employmentWithoutId.middleName + sourceId = employmentWithoutId.sourceId + startDate = employmentWithoutId.startDate + title = employmentWithoutId.title + additionalProperties = employmentWithoutId.additionalProperties.toMutableMap() } /** Worker's compensation classification code for this employee */ @@ -684,8 +683,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxEmploymentUpdateBody = - SandboxEmploymentUpdateBody( + fun build(): EmploymentWithoutId = + EmploymentWithoutId( classCode, (customFields ?: JsonMissing.of()).map { it.toImmutable() }, department, @@ -713,7 +712,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxEmploymentUpdateBody && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmploymentWithoutId && classCode == other.classCode && customFields == other.customFields && department == other.department && employment == other.employment && employmentStatus == other.employmentStatus && endDate == other.endDate && firstName == other.firstName && income == other.income && incomeHistory == other.incomeHistory && isActive == other.isActive && lastName == other.lastName && latestRehireDate == other.latestRehireDate && location == other.location && manager == other.manager && middleName == other.middleName && sourceId == other.sourceId && startDate == other.startDate && title == other.title && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -723,7 +722,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxEmploymentUpdateBody{classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" + "EmploymentWithoutId{classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, employmentStatus=$employmentStatus, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -738,8 +737,7 @@ private constructor( class Builder internal constructor() { private var individualId: String? = null - private var body: SandboxEmploymentUpdateBody.Builder = - SandboxEmploymentUpdateBody.builder() + private var body: EmploymentWithoutId.Builder = EmploymentWithoutId.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -1154,12 +1152,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): CustomField = - CustomField( - name, - value, - additionalProperties.toImmutable(), - ) + fun build(): CustomField = CustomField(name, value, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -1395,23 +1388,15 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Employment = - Employment( - subtype, - type, - additionalProperties.toImmutable(), - ) + fun build(): Employment = Employment(subtype, type, additionalProperties.toImmutable()) } /** * The secondary employment type of the individual. Options: `full_time`, `part_time`, * `intern`, `temp`, `seasonal` and `individual_contractor`. */ - class Subtype - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Subtype @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1510,7 +1495,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Subtype: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1526,11 +1523,7 @@ private constructor( } /** The main employment type of the individual. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1603,7 +1596,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1637,11 +1642,8 @@ private constructor( } /** The detailed employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EmploymentStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1746,7 +1748,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EmploymentStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt index 694c9061..8a1deb50 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParams.kt @@ -26,7 +26,7 @@ import java.util.Optional class SandboxIndividualUpdateParams private constructor( private val individualId: String, - private val body: SandboxIndividualUpdateBody, + private val body: IndividualWithoutId, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -119,7 +119,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxIndividualUpdateBody = body + @JvmSynthetic internal fun _body(): IndividualWithoutId = body override fun _headers(): Headers = additionalHeaders @@ -133,9 +133,9 @@ private constructor( } @NoAutoDetect - class SandboxIndividualUpdateBody + class IndividualWithoutId @JsonCreator - internal constructor( + private constructor( @JsonProperty("dob") @ExcludeMissing private val dob: JsonField = JsonMissing.of(), @JsonProperty("emails") @ExcludeMissing @@ -274,7 +274,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxIndividualUpdateBody = apply { + fun validate(): IndividualWithoutId = apply { if (validated) { return@apply } @@ -301,7 +301,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxIndividualUpdateBody]. */ + /** A builder for [IndividualWithoutId]. */ class Builder internal constructor() { private var dob: JsonField = JsonMissing.of() @@ -319,21 +319,20 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(sandboxIndividualUpdateBody: SandboxIndividualUpdateBody) = apply { - dob = sandboxIndividualUpdateBody.dob - emails = sandboxIndividualUpdateBody.emails.map { it.toMutableList() } - encryptedSsn = sandboxIndividualUpdateBody.encryptedSsn - ethnicity = sandboxIndividualUpdateBody.ethnicity - firstName = sandboxIndividualUpdateBody.firstName - gender = sandboxIndividualUpdateBody.gender - lastName = sandboxIndividualUpdateBody.lastName - middleName = sandboxIndividualUpdateBody.middleName - phoneNumbers = sandboxIndividualUpdateBody.phoneNumbers.map { it.toMutableList() } - preferredName = sandboxIndividualUpdateBody.preferredName - residence = sandboxIndividualUpdateBody.residence - ssn = sandboxIndividualUpdateBody.ssn - additionalProperties = - sandboxIndividualUpdateBody.additionalProperties.toMutableMap() + internal fun from(individualWithoutId: IndividualWithoutId) = apply { + dob = individualWithoutId.dob + emails = individualWithoutId.emails.map { it.toMutableList() } + encryptedSsn = individualWithoutId.encryptedSsn + ethnicity = individualWithoutId.ethnicity + firstName = individualWithoutId.firstName + gender = individualWithoutId.gender + lastName = individualWithoutId.lastName + middleName = individualWithoutId.middleName + phoneNumbers = individualWithoutId.phoneNumbers.map { it.toMutableList() } + preferredName = individualWithoutId.preferredName + residence = individualWithoutId.residence + ssn = individualWithoutId.ssn + additionalProperties = individualWithoutId.additionalProperties.toMutableMap() } fun dob(dob: String?) = dob(JsonField.ofNullable(dob)) @@ -515,8 +514,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxIndividualUpdateBody = - SandboxIndividualUpdateBody( + fun build(): IndividualWithoutId = + IndividualWithoutId( dob, (emails ?: JsonMissing.of()).map { it.toImmutable() }, encryptedSsn, @@ -538,7 +537,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxIndividualUpdateBody && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is IndividualWithoutId && dob == other.dob && emails == other.emails && encryptedSsn == other.encryptedSsn && ethnicity == other.ethnicity && firstName == other.firstName && gender == other.gender && lastName == other.lastName && middleName == other.middleName && phoneNumbers == other.phoneNumbers && preferredName == other.preferredName && residence == other.residence && ssn == other.ssn && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -548,7 +547,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxIndividualUpdateBody{dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" + "IndividualWithoutId{dob=$dob, emails=$emails, encryptedSsn=$encryptedSsn, ethnicity=$ethnicity, firstName=$firstName, gender=$gender, lastName=$lastName, middleName=$middleName, phoneNumbers=$phoneNumbers, preferredName=$preferredName, residence=$residence, ssn=$ssn, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -563,8 +562,7 @@ private constructor( class Builder internal constructor() { private var individualId: String? = null - private var body: SandboxIndividualUpdateBody.Builder = - SandboxIndividualUpdateBody.builder() + private var body: IndividualWithoutId.Builder = IndividualWithoutId.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -924,19 +922,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Email = - Email( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): Email = Email(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1009,7 +998,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1043,11 +1044,7 @@ private constructor( } /** The EEOC-defined ethnicity of the individual. */ - class Ethnicity - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Ethnicity @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1158,7 +1155,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Ethnicity: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1174,11 +1181,7 @@ private constructor( } /** The gender of the individual. */ - class Gender - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Gender @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1262,7 +1265,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Gender: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1363,19 +1376,10 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): PhoneNumber = - PhoneNumber( - data, - type, - additionalProperties.toImmutable(), - ) + fun build(): PhoneNumber = PhoneNumber(data, type, additionalProperties.toImmutable()) } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1448,7 +1452,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt index 874c66b6..28c765c7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfiguration.kt @@ -114,11 +114,8 @@ private constructor( ) } - class CompletionStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class CompletionStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -205,7 +202,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown CompletionStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -220,11 +227,7 @@ private constructor( override fun toString() = value.toString() } - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -245,7 +248,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - DATA_SYNC_ALL, + DATA_SYNC_ALL } /** @@ -290,7 +293,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt index 0eeb3408..8bde74ca 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationRetrieveParams.kt @@ -147,7 +147,7 @@ private constructor( fun build(): SandboxJobConfigurationRetrieveParams = SandboxJobConfigurationRetrieveParams( additionalHeaders.build(), - additionalQueryParams.build() + additionalQueryParams.build(), ) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt index 6b54e4c1..72a0a4d2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParams.kt @@ -2,171 +2,37 @@ package com.tryfinch.api.models -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.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.NoAutoDetect import com.tryfinch.api.core.Params 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.immutableEmptyMap -import com.tryfinch.api.core.toImmutable -import com.tryfinch.api.errors.FinchInvalidDataException import java.util.Objects /** Update configurations for sandbox jobs */ class SandboxJobConfigurationUpdateParams private constructor( - private val body: SandboxJobConfigurationUpdateBody, + private val sandboxJobConfiguration: SandboxJobConfiguration, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - fun completionStatus(): CompletionStatus = body.completionStatus() + fun sandboxJobConfiguration(): SandboxJobConfiguration = sandboxJobConfiguration - fun type(): Type = body.type() - - fun _completionStatus(): JsonField = body._completionStatus() - - fun _type(): JsonField = body._type() - - fun _additionalBodyProperties(): Map = body._additionalProperties() + fun _additionalBodyProperties(): Map = + sandboxJobConfiguration._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxJobConfigurationUpdateBody = body + @JvmSynthetic internal fun _body(): SandboxJobConfiguration = sandboxJobConfiguration override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams - @NoAutoDetect - class SandboxJobConfigurationUpdateBody - @JsonCreator - internal constructor( - @JsonProperty("completion_status") - @ExcludeMissing - private val completionStatus: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), - @JsonAnySetter - private val additionalProperties: Map = immutableEmptyMap(), - ) { - - fun completionStatus(): CompletionStatus = completionStatus.getRequired("completion_status") - - fun type(): Type = type.getRequired("type") - - @JsonProperty("completion_status") - @ExcludeMissing - fun _completionStatus(): JsonField = completionStatus - - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - private var validated: Boolean = false - - fun validate(): SandboxJobConfigurationUpdateBody = apply { - if (validated) { - return@apply - } - - completionStatus() - type() - validated = true - } - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SandboxJobConfigurationUpdateBody]. */ - class Builder internal constructor() { - - private var completionStatus: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - sandboxJobConfigurationUpdateBody: SandboxJobConfigurationUpdateBody - ) = apply { - completionStatus = sandboxJobConfigurationUpdateBody.completionStatus - type = sandboxJobConfigurationUpdateBody.type - additionalProperties = - sandboxJobConfigurationUpdateBody.additionalProperties.toMutableMap() - } - - fun completionStatus(completionStatus: CompletionStatus) = - completionStatus(JsonField.of(completionStatus)) - - fun completionStatus(completionStatus: JsonField) = apply { - this.completionStatus = completionStatus - } - - fun type(type: Type) = type(JsonField.of(type)) - - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - fun build(): SandboxJobConfigurationUpdateBody = - SandboxJobConfigurationUpdateBody( - checkRequired("completionStatus", completionStatus), - checkRequired("type", type), - additionalProperties.toImmutable(), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is SandboxJobConfigurationUpdateBody && completionStatus == other.completionStatus && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ - } - - /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(completionStatus, type, additionalProperties) } - /* spotless:on */ - - override fun hashCode(): Int = hashCode - - override fun toString() = - "SandboxJobConfigurationUpdateBody{completionStatus=$completionStatus, type=$type, additionalProperties=$additionalProperties}" - } - fun toBuilder() = Builder().from(this) companion object { @@ -178,8 +44,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxJobConfigurationUpdateBody.Builder = - SandboxJobConfigurationUpdateBody.builder() + private var sandboxJobConfiguration: SandboxJobConfiguration? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -187,41 +52,14 @@ private constructor( internal fun from( sandboxJobConfigurationUpdateParams: SandboxJobConfigurationUpdateParams ) = apply { - body = sandboxJobConfigurationUpdateParams.body.toBuilder() + sandboxJobConfiguration = sandboxJobConfigurationUpdateParams.sandboxJobConfiguration additionalHeaders = sandboxJobConfigurationUpdateParams.additionalHeaders.toBuilder() additionalQueryParams = sandboxJobConfigurationUpdateParams.additionalQueryParams.toBuilder() } - fun completionStatus(completionStatus: CompletionStatus) = apply { - body.completionStatus(completionStatus) - } - - fun completionStatus(completionStatus: JsonField) = apply { - body.completionStatus(completionStatus) - } - - fun type(type: Type) = apply { body.type(type) } - - fun type(type: JsonField) = apply { body.type(type) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) + fun sandboxJobConfiguration(sandboxJobConfiguration: SandboxJobConfiguration) = apply { + this.sandboxJobConfiguration = sandboxJobConfiguration } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -324,213 +162,22 @@ private constructor( fun build(): SandboxJobConfigurationUpdateParams = SandboxJobConfigurationUpdateParams( - body.build(), + checkRequired("sandboxJobConfiguration", sandboxJobConfiguration), additionalHeaders.build(), additionalQueryParams.build(), ) } - class CompletionStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val COMPLETE = of("complete") - - @JvmField val REAUTH_ERROR = of("reauth_error") - - @JvmField val PERMISSIONS_ERROR = of("permissions_error") - - @JvmField val ERROR = of("error") - - @JvmStatic fun of(value: String) = CompletionStatus(JsonField.of(value)) - } - - /** An enum containing [CompletionStatus]'s known values. */ - enum class Known { - COMPLETE, - REAUTH_ERROR, - PERMISSIONS_ERROR, - ERROR, - } - - /** - * An enum containing [CompletionStatus]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [CompletionStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - COMPLETE, - REAUTH_ERROR, - PERMISSIONS_ERROR, - ERROR, - /** - * An enum member indicating that [CompletionStatus] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - COMPLETE -> Value.COMPLETE - REAUTH_ERROR -> Value.REAUTH_ERROR - PERMISSIONS_ERROR -> Value.PERMISSIONS_ERROR - ERROR -> Value.ERROR - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws FinchInvalidDataException if this class instance's value is a not a known member. - */ - fun known(): Known = - when (this) { - COMPLETE -> Known.COMPLETE - REAUTH_ERROR -> Known.REAUTH_ERROR - PERMISSIONS_ERROR -> Known.PERMISSIONS_ERROR - ERROR -> Known.ERROR - else -> throw FinchInvalidDataException("Unknown CompletionStatus: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is CompletionStatus && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val DATA_SYNC_ALL = of("data_sync_all") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - DATA_SYNC_ALL, - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DATA_SYNC_ALL, - /** An enum member indicating that [Type] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DATA_SYNC_ALL -> Value.DATA_SYNC_ALL - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws FinchInvalidDataException if this class instance's value is a not a known member. - */ - fun known(): Known = - when (this) { - DATA_SYNC_ALL -> Known.DATA_SYNC_ALL - else -> throw FinchInvalidDataException("Unknown Type: $value") - } - - fun asString(): String = _value().asStringOrThrow() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is Type && value == other.value /* spotless:on */ - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is SandboxJobConfigurationUpdateParams && body == other.body && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is SandboxJobConfigurationUpdateParams && sandboxJobConfiguration == other.sandboxJobConfiguration && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(body, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(sandboxJobConfiguration, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "SandboxJobConfigurationUpdateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SandboxJobConfigurationUpdateParams{sandboxJobConfiguration=$sandboxJobConfiguration, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt index 8babd659..089b6b57 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxJobCreateParams.kt @@ -24,7 +24,7 @@ import java.util.Objects /** Enqueue a new sandbox job */ class SandboxJobCreateParams private constructor( - private val body: SandboxJobCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -41,16 +41,16 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxJobCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders override fun _queryParams(): QueryParams = additionalQueryParams @NoAutoDetect - class SandboxJobCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), @@ -68,7 +68,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxJobCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -84,16 +84,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxJobCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var type: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(sandboxJobCreateBody: SandboxJobCreateBody) = apply { - type = sandboxJobCreateBody.type - additionalProperties = sandboxJobCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + type = body.type + additionalProperties = body.additionalProperties.toMutableMap() } /** The type of job to start. Currently the only supported type is `data_sync_all` */ @@ -121,11 +121,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxJobCreateBody = - SandboxJobCreateBody( - checkRequired("type", type), - additionalProperties.toImmutable() - ) + fun build(): Body = + Body(checkRequired("type", type), additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { @@ -133,7 +130,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxJobCreateBody && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -142,8 +139,7 @@ private constructor( override fun hashCode(): Int = hashCode - override fun toString() = - "SandboxJobCreateBody{type=$type, additionalProperties=$additionalProperties}" + override fun toString() = "Body{type=$type, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -157,7 +153,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxJobCreateBody.Builder = SandboxJobCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -300,11 +296,7 @@ private constructor( } /** The type of job to start. Currently the only supported type is `data_sync_all` */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -325,7 +317,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - DATA_SYNC_ALL, + DATA_SYNC_ALL } /** @@ -370,7 +362,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt index c0829f94..f28985d0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParams.kt @@ -24,7 +24,7 @@ import java.util.Optional /** Add a new sandbox payment */ class SandboxPaymentCreateParams private constructor( - private val body: SandboxPaymentCreateBody, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -47,7 +47,7 @@ private constructor( fun _additionalQueryParams(): QueryParams = additionalQueryParams - @JvmSynthetic internal fun _body(): SandboxPaymentCreateBody = body + @JvmSynthetic internal fun _body(): Body = body override fun _headers(): Headers = additionalHeaders @@ -58,9 +58,9 @@ private constructor( * are optional. */ @NoAutoDetect - class SandboxPaymentCreateBody + class Body @JsonCreator - internal constructor( + private constructor( @JsonProperty("end_date") @ExcludeMissing private val endDate: JsonField = JsonMissing.of(), @@ -95,7 +95,7 @@ private constructor( private var validated: Boolean = false - fun validate(): SandboxPaymentCreateBody = apply { + fun validate(): Body = apply { if (validated) { return@apply } @@ -113,7 +113,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [SandboxPaymentCreateBody]. */ + /** A builder for [Body]. */ class Builder internal constructor() { private var endDate: JsonField = JsonMissing.of() @@ -122,11 +122,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(sandboxPaymentCreateBody: SandboxPaymentCreateBody) = apply { - endDate = sandboxPaymentCreateBody.endDate - payStatements = sandboxPaymentCreateBody.payStatements.map { it.toMutableList() } - startDate = sandboxPaymentCreateBody.startDate - additionalProperties = sandboxPaymentCreateBody.additionalProperties.toMutableMap() + internal fun from(body: Body) = apply { + endDate = body.endDate + payStatements = body.payStatements.map { it.toMutableList() } + startDate = body.startDate + additionalProperties = body.additionalProperties.toMutableMap() } fun endDate(endDate: String) = endDate(JsonField.of(endDate)) @@ -176,8 +176,8 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): SandboxPaymentCreateBody = - SandboxPaymentCreateBody( + fun build(): Body = + Body( endDate, (payStatements ?: JsonMissing.of()).map { it.toImmutable() }, startDate, @@ -190,7 +190,7 @@ private constructor( return true } - return /* spotless:off */ other is SandboxPaymentCreateBody && endDate == other.endDate && payStatements == other.payStatements && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && endDate == other.endDate && payStatements == other.payStatements && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ @@ -200,7 +200,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SandboxPaymentCreateBody{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalProperties=$additionalProperties}" + "Body{endDate=$endDate, payStatements=$payStatements, startDate=$startDate, additionalProperties=$additionalProperties}" } fun toBuilder() = Builder().from(this) @@ -214,7 +214,7 @@ private constructor( @NoAutoDetect class Builder internal constructor() { - private var body: SandboxPaymentCreateBody.Builder = SandboxPaymentCreateBody.builder() + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -743,6 +743,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -762,6 +765,9 @@ private constructor( /** The earnings amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The earnings currency code. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -780,6 +786,10 @@ private constructor( /** The earnings amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The earnings currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -807,6 +817,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() hours() name() @@ -825,6 +836,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var hours: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -834,6 +846,7 @@ private constructor( @JvmSynthetic internal fun from(earning: Earning) = apply { amount = earning.amount + attributes = earning.attributes currency = earning.currency hours = earning.hours name = earning.name @@ -854,6 +867,14 @@ private constructor( /** The earnings amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } + /** The earnings currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -931,6 +952,7 @@ private constructor( fun build(): Earning = Earning( amount, + attributes, currency, hours, name, @@ -939,12 +961,219 @@ private constructor( ) } - /** The type of earning. */ - class Type + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + /** The type of earning. */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1085,7 +1314,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1105,17 +1346,17 @@ private constructor( return true } - return /* spotless:off */ other is Earning && amount == other.amount && currency == other.currency && hours == other.hours && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Earning && amount == other.amount && attributes == other.attributes && currency == other.currency && hours == other.hours && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, hours, name, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, hours, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Earning{amount=$amount, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" + "Earning{amount=$amount, attributes=$attributes, currency=$currency, hours=$hours, name=$name, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1125,6 +1366,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1144,6 +1388,9 @@ private constructor( /** The deduction amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The deduction currency. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -1159,6 +1406,10 @@ private constructor( /** The deduction amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The deduction currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1183,6 +1434,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() name() preTax() @@ -1201,6 +1453,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var preTax: JsonField = JsonMissing.of() @@ -1210,6 +1463,7 @@ private constructor( @JvmSynthetic internal fun from(employeeDeduction: EmployeeDeduction) = apply { amount = employeeDeduction.amount + attributes = employeeDeduction.attributes currency = employeeDeduction.currency name = employeeDeduction.name preTax = employeeDeduction.preTax @@ -1230,6 +1484,14 @@ private constructor( /** The deduction amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } + /** The deduction currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1295,6 +1557,7 @@ private constructor( fun build(): EmployeeDeduction = EmployeeDeduction( amount, + attributes, currency, name, preTax, @@ -1303,22 +1566,232 @@ private constructor( ) } + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EmployeeDeduction && amount == other.amount && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployeeDeduction && amount == other.amount && attributes == other.attributes && currency == other.currency && name == other.name && preTax == other.preTax && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, name, preTax, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, name, preTax, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployeeDeduction{amount=$amount, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" + "EmployeeDeduction{amount=$amount, attributes=$attributes, currency=$currency, name=$name, preTax=$preTax, type=$type, additionalProperties=$additionalProperties}" } @NoAutoDetect @@ -1328,6 +1801,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1344,6 +1820,9 @@ private constructor( /** The contribution amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The contribution currency. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -1356,6 +1835,10 @@ private constructor( /** The contribution amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The contribution currency. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1377,6 +1860,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() name() type() @@ -1394,6 +1878,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() @@ -1402,6 +1887,7 @@ private constructor( @JvmSynthetic internal fun from(employerContribution: EmployerContribution) = apply { amount = employerContribution.amount + attributes = employerContribution.attributes currency = employerContribution.currency name = employerContribution.name type = employerContribution.type @@ -1421,6 +1907,14 @@ private constructor( /** The contribution amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } + /** The contribution currency. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1473,6 +1967,7 @@ private constructor( fun build(): EmployerContribution = EmployerContribution( amount, + attributes, currency, name, type, @@ -1480,30 +1975,237 @@ private constructor( ) } + @NoAutoDetect + class Metadata + @JsonCreator + private constructor( + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is EmployerContribution && amount == other.amount && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is EmployerContribution && amount == other.amount && attributes == other.attributes && currency == other.currency && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, name, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "EmployerContribution{amount=$amount, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" + "EmployerContribution{amount=$amount, attributes=$attributes, currency=$currency, name=$name, type=$type, additionalProperties=$additionalProperties}" } /** The payment method. */ - class PaymentMethod - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class PaymentMethod @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1579,7 +2281,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown PaymentMethod: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1601,6 +2315,9 @@ private constructor( @JsonProperty("amount") @ExcludeMissing private val amount: JsonField = JsonMissing.of(), + @JsonProperty("attributes") + @ExcludeMissing + private val attributes: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing private val currency: JsonField = JsonMissing.of(), @@ -1620,6 +2337,9 @@ private constructor( /** The tax amount in cents. */ fun amount(): Optional = Optional.ofNullable(amount.getNullable("amount")) + fun attributes(): Optional = + Optional.ofNullable(attributes.getNullable("attributes")) + /** The currency code. */ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency")) @@ -1636,6 +2356,10 @@ private constructor( /** The tax amount in cents. */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + @JsonProperty("attributes") + @ExcludeMissing + fun _attributes(): JsonField = attributes + /** The currency code. */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency @@ -1660,6 +2384,7 @@ private constructor( } amount() + attributes().ifPresent { it.validate() } currency() employer() name() @@ -1678,6 +2403,7 @@ private constructor( class Builder internal constructor() { private var amount: JsonField = JsonMissing.of() + private var attributes: JsonField = JsonMissing.of() private var currency: JsonField = JsonMissing.of() private var employer: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() @@ -1687,6 +2413,7 @@ private constructor( @JvmSynthetic internal fun from(tax: Tax) = apply { amount = tax.amount + attributes = tax.attributes currency = tax.currency employer = tax.employer name = tax.name @@ -1707,6 +2434,14 @@ private constructor( /** The tax amount in cents. */ fun amount(amount: JsonField) = apply { this.amount = amount } + fun attributes(attributes: Metadata?) = attributes(JsonField.ofNullable(attributes)) + + fun attributes(attributes: Optional) = attributes(attributes.orElse(null)) + + fun attributes(attributes: JsonField) = apply { + this.attributes = attributes + } + /** The currency code. */ fun currency(currency: String?) = currency(JsonField.ofNullable(currency)) @@ -1773,6 +2508,7 @@ private constructor( fun build(): Tax = Tax( amount, + attributes, currency, employer, name, @@ -1781,12 +2517,219 @@ private constructor( ) } - /** The type of taxes. */ - class Type + @NoAutoDetect + class Metadata @JsonCreator private constructor( - private val value: JsonField, - ) : Enum { + @JsonProperty("metadata") + @ExcludeMissing + private val metadata: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + fun metadata(): Optional = + Optional.ofNullable(metadata.getNullable("metadata")) + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + metadata().ifPresent { it.validate() } + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var metadata: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + this.metadata = metadata.metadata + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: InnerMetadata) = metadata(JsonField.of(metadata)) + + /** + * The metadata to be attached to the entity by existing rules. It is a + * key-value pairs where the values can be of any type (string, number, boolean, + * object, array, etc.). + */ + fun metadata(metadata: JsonField) = apply { + this.metadata = metadata + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): Metadata = Metadata(metadata, additionalProperties.toImmutable()) + } + + /** + * The metadata to be attached to the entity by existing rules. It is a key-value + * pairs where the values can be of any type (string, number, boolean, object, + * array, etc.). + */ + @NoAutoDetect + class InnerMetadata + @JsonCreator + private constructor( + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap() + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): InnerMetadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + /** A builder for [InnerMetadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(innerMetadata: InnerMetadata) = apply { + additionalProperties = innerMetadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + fun build(): InnerMetadata = + InnerMetadata(additionalProperties.toImmutable()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is InnerMetadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "InnerMetadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Metadata && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(metadata, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{metadata=$metadata, additionalProperties=$additionalProperties}" + } + + /** The type of taxes. */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1873,7 +2816,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1893,25 +2848,21 @@ private constructor( return true } - return /* spotless:off */ other is Tax && amount == other.amount && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Tax && amount == other.amount && attributes == other.attributes && currency == other.currency && employer == other.employer && name == other.name && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, currency, employer, name, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, attributes, currency, employer, name, type, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Tax{amount=$amount, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" + "Tax{amount=$amount, attributes=$attributes, currency=$currency, employer=$employer, name=$name, type=$type, additionalProperties=$additionalProperties}" } /** The type of the payment associated with the pay statement. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1990,7 +2941,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt index 174b02b1..b23e5480 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/SupportedBenefit.kt @@ -396,9 +396,7 @@ private constructor( class CompanyContribution @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -473,7 +471,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown CompanyContribution: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -488,11 +496,8 @@ private constructor( override fun toString() = value.toString() } - class EmployeeDeduction - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class EmployeeDeduction @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -567,7 +572,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown EmployeeDeduction: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { @@ -584,9 +599,7 @@ private constructor( class HsaContributionLimit @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -662,7 +675,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown HsaContributionLimit: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt index ade72313..f5adb2ec 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UnenrolledIndividual.kt @@ -121,12 +121,7 @@ private constructor( } fun build(): UnenrolledIndividual = - UnenrolledIndividual( - body, - code, - individualId, - additionalProperties.toImmutable(), - ) + UnenrolledIndividual(body, code, individualId, additionalProperties.toImmutable()) } @NoAutoDetect @@ -250,13 +245,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): Body = - Body( - finchCode, - message, - name, - additionalProperties.toImmutable(), - ) + fun build(): Body = Body(finchCode, message, name, additionalProperties.toImmutable()) } override fun equals(other: Any?): Boolean { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt index d1a7e8ba..95463baa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/UpdateCompanyBenefitResponse.kt @@ -90,7 +90,7 @@ private constructor( fun build(): UpdateCompanyBenefitResponse = UpdateCompanyBenefitResponse( checkRequired("benefitId", benefitId), - additionalProperties.toImmutable() + additionalProperties.toImmutable(), ) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt index 98111406..4f4b07fe 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -134,13 +134,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): W42005 = - W42005( - data, - type, - year, - additionalProperties.toImmutable(), - ) + fun build(): W42005 = W42005(data, type, year, additionalProperties.toImmutable()) } /** Detailed information specific to the 2005 W4 form. */ @@ -347,11 +341,8 @@ private constructor( } /** Indicates exemption status from federal tax withholding. */ - class Exemption - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Exemption @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -427,7 +418,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Exemption: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -443,11 +446,8 @@ private constructor( } /** The individual's filing status for tax purposes. */ - class FilingStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class FilingStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -533,7 +533,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown FilingStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -567,11 +579,7 @@ private constructor( } /** Specifies the form type, indicating that this document is a 2005 W4 form. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -592,7 +600,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - W4_2005, + W4_2005 } /** @@ -637,7 +645,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt index 91bf811e..42baad1c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -134,13 +134,7 @@ private constructor( keys.forEach(::removeAdditionalProperty) } - fun build(): W42020 = - W42020( - data, - type, - year, - additionalProperties.toImmutable(), - ) + fun build(): W42020 = W42020(data, type, year, additionalProperties.toImmutable()) } /** Detailed information specific to the 2020 W4 form. */ @@ -481,11 +475,8 @@ private constructor( } /** The individual's filing status for tax purposes. */ - class FilingStatus - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class FilingStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -572,7 +563,19 @@ private constructor( else -> throw FinchInvalidDataException("Unknown FilingStatus: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + FinchInvalidDataException("Value is not a String") + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -606,11 +609,7 @@ private constructor( } /** Specifies the form type, indicating that this document is a 2020 W4 form. */ - class Type - @JsonCreator - private constructor( - private val value: JsonField, - ) : Enum { + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -631,7 +630,7 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - W4_2020, + W4_2020 } /** @@ -676,7 +675,17 @@ private constructor( else -> throw FinchInvalidDataException("Unknown Type: $value") } - fun asString(): String = _value().asStringOrThrow() + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws FinchInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { FinchInvalidDataException("Value is not a String") } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt index 57c76c37..fd604b72 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/WebhookEvent.kt @@ -274,7 +274,7 @@ private constructor( override fun serialize( value: WebhookEvent, generator: JsonGenerator, - provider: SerializerProvider + provider: SerializerProvider, ) { when { value.accountUpdate != null -> generator.writeObject(value.accountUpdate) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt index a335874c..42797f29 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsync.kt @@ -15,6 +15,6 @@ interface AccessTokenServiceAsync { @JvmOverloads fun create( params: AccessTokenCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt index 16392293..3a5a40a0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccessTokenServiceAsyncImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse import java.util.concurrent.CompletableFuture -class AccessTokenServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AccessTokenServiceAsync { +class AccessTokenServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + AccessTokenServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Exchange the authorization code for an access token */ override fun create( params: AccessTokenCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val builder = params.toBuilder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt index 1759239f..b602490d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsync.kt @@ -17,13 +17,13 @@ interface AccountServiceAsync { @JvmOverloads fun disconnect( params: AccountDisconnectParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Read account information associated with an `access_token` */ @JvmOverloads fun introspect( params: AccountIntrospectParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt index 12fb92bd..218b9c5d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/AccountServiceAsyncImpl.kt @@ -19,10 +19,8 @@ import com.tryfinch.api.models.DisconnectResponse import com.tryfinch.api.models.Introspection import java.util.concurrent.CompletableFuture -class AccountServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AccountServiceAsync { +class AccountServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + AccountServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Disconnect one or more `access_token`s from your application. */ override fun disconnect( params: AccountDisconnectParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -60,7 +58,7 @@ internal constructor( /** Read account information associated with an `access_token` */ override fun introspect( params: AccountIntrospectParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt index f86fb285..a019a5c1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ConnectServiceAsyncImpl.kt @@ -6,10 +6,8 @@ import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.services.async.connect.SessionServiceAsync import com.tryfinch.api.services.async.connect.SessionServiceAsyncImpl -class ConnectServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ConnectServiceAsync { +class ConnectServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectServiceAsync { private val sessions: SessionServiceAsync by lazy { SessionServiceAsyncImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt index d39d2925..913a435f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsyncImpl.kt @@ -20,10 +20,8 @@ import com.tryfinch.api.services.async.hris.PayStatementServiceAsyncImpl import com.tryfinch.api.services.async.hris.PaymentServiceAsync import com.tryfinch.api.services.async.hris.PaymentServiceAsyncImpl -class HrisServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : HrisServiceAsync { +class HrisServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + HrisServiceAsync { private val company: CompanyServiceAsync by lazy { CompanyServiceAsyncImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt index a8a0006f..264fb526 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/JobServiceAsyncImpl.kt @@ -8,10 +8,8 @@ import com.tryfinch.api.services.async.jobs.AutomatedServiceAsyncImpl import com.tryfinch.api.services.async.jobs.ManualServiceAsync import com.tryfinch.api.services.async.jobs.ManualServiceAsyncImpl -class JobServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : JobServiceAsync { +class JobServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + JobServiceAsync { private val automated: AutomatedServiceAsync by lazy { AutomatedServiceAsyncImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt index 6431023a..a856537b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/PayrollServiceAsyncImpl.kt @@ -6,10 +6,8 @@ import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.services.async.payroll.PayGroupServiceAsync import com.tryfinch.api.services.async.payroll.PayGroupServiceAsyncImpl -class PayrollServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PayrollServiceAsync { +class PayrollServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PayrollServiceAsync { private val payGroups: PayGroupServiceAsync by lazy { PayGroupServiceAsyncImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt index a0c9d904..7fe3883c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsync.kt @@ -15,6 +15,6 @@ interface ProviderServiceAsync { @JvmOverloads fun list( params: ProviderListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt index ace4182b..08227c2a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.ProviderListPageAsync import com.tryfinch.api.models.ProviderListParams import java.util.concurrent.CompletableFuture -class ProviderServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ProviderServiceAsync { +class ProviderServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ProviderServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Return details on all available payroll and HR systems. */ override fun list( params: ProviderListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -52,7 +50,7 @@ internal constructor( ProviderListPageAsync.of( this, params, - ProviderListPageAsync.Response.builder().items(it).build() + ProviderListPageAsync.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt index 074159d0..824ada2d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsync.kt @@ -19,6 +19,6 @@ interface RequestForwardingServiceAsync { @JvmOverloads fun forward( params: RequestForwardingForwardParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt index 70742b77..bcc50f5c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/RequestForwardingServiceAsyncImpl.kt @@ -18,9 +18,7 @@ import com.tryfinch.api.models.RequestForwardingForwardResponse import java.util.concurrent.CompletableFuture class RequestForwardingServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : RequestForwardingServiceAsync { +internal constructor(private val clientOptions: ClientOptions) : RequestForwardingServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -35,7 +33,7 @@ internal constructor( */ override fun forward( params: RequestForwardingForwardParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt index 1557fa1a..d68cb53a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/SandboxServiceAsyncImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.services.async.sandbox.JobServiceAsyncImpl import com.tryfinch.api.services.async.sandbox.PaymentServiceAsync import com.tryfinch.api.services.async.sandbox.PaymentServiceAsyncImpl -class SandboxServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SandboxServiceAsync { +class SandboxServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SandboxServiceAsync { private val connections: ConnectionServiceAsync by lazy { ConnectionServiceAsyncImpl(clientOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt index d85619e0..598b6b8e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/WebhookServiceAsyncImpl.kt @@ -18,10 +18,8 @@ import java.util.Base64 import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec -class WebhookServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : WebhookServiceAsync { +class WebhookServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + WebhookServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt index 26af3b52..e79109d7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsync.kt @@ -17,13 +17,13 @@ interface SessionServiceAsync { @JvmOverloads fun new_( params: ConnectSessionNewParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Create a new Connect session for reauthenticating an existing connection */ @JvmOverloads fun reauthenticate( params: ConnectSessionReauthenticateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt index b2d06dbc..385c1cb5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/connect/SessionServiceAsyncImpl.kt @@ -19,10 +19,8 @@ import com.tryfinch.api.models.SessionNewResponse import com.tryfinch.api.models.SessionReauthenticateResponse import java.util.concurrent.CompletableFuture -class SessionServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SessionServiceAsync { +class SessionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + SessionServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Create a new connect session for an employer */ override fun new_( params: ConnectSessionNewParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -61,7 +59,7 @@ internal constructor( /** Create a new Connect session for reauthenticating an existing connection */ override fun reauthenticate( params: ConnectSessionReauthenticateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt index 0805aad8..6f547577 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsync.kt @@ -29,34 +29,34 @@ interface BenefitServiceAsync { @JvmOverloads fun create( params: HrisBenefitCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Lists deductions and contributions information for a given item */ @JvmOverloads fun retrieve( params: HrisBenefitRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Updates an existing company-wide deduction or contribution */ @JvmOverloads fun update( params: HrisBenefitUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** List all company-wide deductions and contributions. */ @JvmOverloads fun list( params: HrisBenefitListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get deductions metadata */ @JvmOverloads fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index cf6c3816..88f2f69f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -28,10 +28,8 @@ import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsync import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsyncImpl import java.util.concurrent.CompletableFuture -class BenefitServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : BenefitServiceAsync { +class BenefitServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + BenefitServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -51,7 +49,7 @@ internal constructor( */ override fun create( params: HrisBenefitCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -79,7 +77,7 @@ internal constructor( /** Lists deductions and contributions information for a given item */ override fun retrieve( params: HrisBenefitRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -107,7 +105,7 @@ internal constructor( /** Updates an existing company-wide deduction or contribution */ override fun update( params: HrisBenefitUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -135,7 +133,7 @@ internal constructor( /** List all company-wide deductions and contributions. */ override fun list( params: HrisBenefitListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -157,7 +155,7 @@ internal constructor( HrisBenefitListPageAsync.of( this, params, - HrisBenefitListPageAsync.Response.builder().items(it).build() + HrisBenefitListPageAsync.Response.builder().items(it).build(), ) } } @@ -169,7 +167,7 @@ internal constructor( /** Get deductions metadata */ override fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -193,7 +191,7 @@ internal constructor( params, HrisBenefitListSupportedBenefitsPageAsync.Response.builder() .items(it) - .build() + .build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt index 339bf081..250bddee 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsync.kt @@ -15,6 +15,6 @@ interface CompanyServiceAsync { @JvmOverloads fun retrieve( params: HrisCompanyRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt index fe766f4a..36830f68 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/CompanyServiceAsyncImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams import java.util.concurrent.CompletableFuture -class CompanyServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CompanyServiceAsync { +class CompanyServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,7 +27,7 @@ internal constructor( /** Read basic company data */ override fun retrieve( params: HrisCompanyRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt index 6c42d153..e0afdd7f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsync.kt @@ -17,7 +17,7 @@ interface DirectoryServiceAsync { @JvmOverloads fun list( params: HrisDirectoryListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Read company directory and organization structure */ @@ -25,6 +25,6 @@ interface DirectoryServiceAsync { @JvmOverloads fun listIndividuals( params: HrisDirectoryListIndividualsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt index 2c864b2b..00b8c0bb 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.HrisDirectoryListPageAsync import com.tryfinch.api.models.HrisDirectoryListParams import java.util.concurrent.CompletableFuture -class DirectoryServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DirectoryServiceAsync { +class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Read company directory and organization structure */ override fun list( params: HrisDirectoryListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -62,7 +60,7 @@ internal constructor( @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt index 182bca7f..80833114 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt @@ -19,7 +19,7 @@ interface DocumentServiceAsync { @JvmOverloads fun list( params: HrisDocumentListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -29,6 +29,6 @@ interface DocumentServiceAsync { @JvmOverloads fun retreive( params: HrisDocumentRetreiveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt index ee9d305e..a3faa516 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.HrisDocumentListParams import com.tryfinch.api.models.HrisDocumentRetreiveParams import java.util.concurrent.CompletableFuture -class DocumentServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DocumentServiceAsync { +class DocumentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -33,7 +31,7 @@ internal constructor( */ override fun list( params: HrisDocumentListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -64,7 +62,7 @@ internal constructor( */ override fun retreive( params: HrisDocumentRetreiveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt index 07dd2ccd..d12c27bc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsync.kt @@ -15,6 +15,6 @@ interface EmploymentServiceAsync { @JvmOverloads fun retrieveMany( params: HrisEmploymentRetrieveManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt index 4641c6dc..07a11f84 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.HrisEmploymentRetrieveManyPageAsync import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams import java.util.concurrent.CompletableFuture -class EmploymentServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : EmploymentServiceAsync { +class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Read individual employment and income data */ override fun retrieveMany( params: HrisEmploymentRetrieveManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt index 899ae063..c888eba6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt @@ -15,6 +15,6 @@ interface IndividualServiceAsync { @JvmOverloads fun retrieveMany( params: HrisIndividualRetrieveManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt index 8ee3f4d5..a901d00d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.HrisIndividualRetrieveManyPageAsync import com.tryfinch.api.models.HrisIndividualRetrieveManyParams import java.util.concurrent.CompletableFuture -class IndividualServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : IndividualServiceAsync { +class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Read individual data, excluding income and employment data */ override fun retrieveMany( params: HrisIndividualRetrieveManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt index 00bf54fb..6cb4e5d8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsync.kt @@ -19,6 +19,6 @@ interface PayStatementServiceAsync { @JvmOverloads fun retrieveMany( params: HrisPayStatementRetrieveManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt index 92a73112..5b5ac320 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.HrisPayStatementRetrieveManyPageAsync import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams import java.util.concurrent.CompletableFuture -class PayStatementServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PayStatementServiceAsync { +class PayStatementServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -35,7 +33,7 @@ internal constructor( */ override fun retrieveMany( params: HrisPayStatementRetrieveManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt index d734128c..98dee989 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsync.kt @@ -15,6 +15,6 @@ interface PaymentServiceAsync { @JvmOverloads fun list( params: HrisPaymentListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt index d78ed34b..db387453 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.HrisPaymentListParams import com.tryfinch.api.models.Payment import java.util.concurrent.CompletableFuture -class PaymentServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PaymentServiceAsync { +class PaymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Read payroll and contractor related payments by the company. */ override fun list( params: HrisPaymentListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -52,7 +50,7 @@ internal constructor( HrisPaymentListPageAsync.of( this, params, - HrisPaymentListPageAsync.Response.builder().items(it).build() + HrisPaymentListPageAsync.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt index 84a4f2d3..62575fe9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsync.kt @@ -19,20 +19,20 @@ interface IndividualServiceAsync { @JvmOverloads fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get enrollment information for the given individuals. */ @JvmOverloads fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Unenroll individuals from a deduction or contribution */ @JvmOverloads fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index b60550b9..db7f5262 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -23,10 +23,8 @@ import com.tryfinch.api.models.IndividualEnrolledIdsResponse import com.tryfinch.api.models.UnenrolledIndividual import java.util.concurrent.CompletableFuture -class IndividualServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : IndividualServiceAsync { +class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -37,7 +35,7 @@ internal constructor( /** Lists individuals currently enrolled in a given deduction. */ override fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -65,7 +63,7 @@ internal constructor( /** Get enrollment information for the given individuals. */ override fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -89,7 +87,7 @@ internal constructor( params, HrisBenefitIndividualRetrieveManyBenefitsPageAsync.Response.builder() .items(it) - .build() + .build(), ) } } @@ -102,7 +100,7 @@ internal constructor( /** Unenroll individuals from a deduction or contribution */ override fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -127,7 +125,7 @@ internal constructor( params, HrisBenefitIndividualUnenrollManyPageAsync.Response.builder() .items(it) - .build() + .build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt index 4489016e..aecaf07b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsync.kt @@ -33,14 +33,14 @@ interface AutomatedServiceAsync { @JvmOverloads fun create( params: JobAutomatedCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Get an automated job by `job_id`. */ @JvmOverloads fun retrieve( params: JobAutomatedRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -51,6 +51,6 @@ interface AutomatedServiceAsync { @JvmOverloads fun list( params: JobAutomatedListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt index b40330e6..9a621fc9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/AutomatedServiceAsyncImpl.kt @@ -21,10 +21,8 @@ import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams import java.util.concurrent.CompletableFuture -class AutomatedServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AutomatedServiceAsync { +class AutomatedServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + AutomatedServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -49,13 +47,13 @@ internal constructor( */ override fun create( params: JobAutomatedCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("jobs", "automated") - .body(json(clientOptions.jsonMapper, params._body())) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepareAsync(clientOptions, params) return request @@ -77,7 +75,7 @@ internal constructor( /** Get an automated job by `job_id`. */ override fun retrieve( params: JobAutomatedRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -109,7 +107,7 @@ internal constructor( */ override fun list( params: JobAutomatedListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt index 4de2be8c..b3b9e674 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsync.kt @@ -18,6 +18,6 @@ interface ManualServiceAsync { @JvmOverloads fun retrieve( params: JobManualRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt index bc85ac72..4b05c57a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/jobs/ManualServiceAsyncImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.models.JobManualRetrieveParams import com.tryfinch.api.models.ManualAsyncJob import java.util.concurrent.CompletableFuture -class ManualServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ManualServiceAsync { +class ManualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ManualServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( */ override fun retrieve( params: JobManualRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt index 4761934d..92ee6590 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsync.kt @@ -17,13 +17,13 @@ interface PayGroupServiceAsync { @JvmOverloads fun retrieve( params: PayrollPayGroupRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** Read company pay groups and frequencies */ @JvmOverloads fun list( params: PayrollPayGroupListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt index a62ed715..c9fa6c1a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt @@ -19,10 +19,8 @@ import com.tryfinch.api.models.PayrollPayGroupListParams import com.tryfinch.api.models.PayrollPayGroupRetrieveParams import java.util.concurrent.CompletableFuture -class PayGroupServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PayGroupServiceAsync { +class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PayGroupServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -33,7 +31,7 @@ internal constructor( /** Read information from a single pay group */ override fun retrieve( params: PayrollPayGroupRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -61,7 +59,7 @@ internal constructor( /** Read company pay groups and frequencies */ override fun list( params: PayrollPayGroupListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -83,7 +81,7 @@ internal constructor( PayrollPayGroupListPageAsync.of( this, params, - PayrollPayGroupListPageAsync.Response.builder().items(it).build() + PayrollPayGroupListPageAsync.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt index 8565c002..09dc9208 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsync.kt @@ -15,6 +15,6 @@ interface CompanyServiceAsync { @JvmOverloads fun update( params: SandboxCompanyUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt index f3a188cf..4ca29904 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/CompanyServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.CompanyUpdateResponse import com.tryfinch.api.models.SandboxCompanyUpdateParams import java.util.concurrent.CompletableFuture -class CompanyServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CompanyServiceAsync { +class CompanyServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Update a sandbox company's data */ override fun update( params: SandboxCompanyUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt index cd3a9715..02284513 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsync.kt @@ -18,6 +18,6 @@ interface ConnectionServiceAsync { @JvmOverloads fun create( params: SandboxConnectionCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt index f3fbb40c..aecc772e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/ConnectionServiceAsyncImpl.kt @@ -19,10 +19,8 @@ import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsync import com.tryfinch.api.services.async.sandbox.connections.AccountServiceAsyncImpl import java.util.concurrent.CompletableFuture -class ConnectionServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ConnectionServiceAsync { +class ConnectionServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectionServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -37,7 +35,7 @@ internal constructor( /** Create a new connection (new company/provider pair) with a new account */ override fun create( params: SandboxConnectionCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt index 20741d7c..7802b965 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsync.kt @@ -15,6 +15,6 @@ interface DirectoryServiceAsync { @JvmOverloads fun create( params: SandboxDirectoryCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt index a85a58fc..f65ae934 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/DirectoryServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxDirectoryCreateParams import java.util.concurrent.CompletableFuture -class DirectoryServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DirectoryServiceAsync { +class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,13 +28,13 @@ internal constructor( /** Add new individuals to a sandbox company */ override fun create( params: SandboxDirectoryCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("sandbox", "directory") - .body(json(clientOptions.jsonMapper, params._body())) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepareAsync(clientOptions, params) return request diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt index 4c8888aa..00219b33 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsync.kt @@ -15,6 +15,6 @@ interface EmploymentServiceAsync { @JvmOverloads fun update( params: SandboxEmploymentUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt index aa2c9d0b..11baffe9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/EmploymentServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.EmploymentUpdateResponse import com.tryfinch.api.models.SandboxEmploymentUpdateParams import java.util.concurrent.CompletableFuture -class EmploymentServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : EmploymentServiceAsync { +class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Update sandbox employment */ override fun update( params: SandboxEmploymentUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt index eead5ee1..81695b1c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsync.kt @@ -15,6 +15,6 @@ interface IndividualServiceAsync { @JvmOverloads fun update( params: SandboxIndividualUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt index f01dc64f..d194f2c1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/IndividualServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.IndividualUpdateResponse import com.tryfinch.api.models.SandboxIndividualUpdateParams import java.util.concurrent.CompletableFuture -class IndividualServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : IndividualServiceAsync { +class IndividualServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Update sandbox individual */ override fun update( params: SandboxIndividualUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt index 40b1d48c..56612e5b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsync.kt @@ -18,6 +18,6 @@ interface JobServiceAsync { @JvmOverloads fun create( params: SandboxJobCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt index ec086214..ae344f6c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/JobServiceAsyncImpl.kt @@ -19,10 +19,8 @@ import com.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsync import com.tryfinch.api.services.async.sandbox.jobs.ConfigurationServiceAsyncImpl import java.util.concurrent.CompletableFuture -class JobServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : JobServiceAsync { +class JobServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + JobServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -38,7 +36,7 @@ internal constructor( /** Enqueue a new sandbox job */ override fun create( params: SandboxJobCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt index 0cd953ff..00f99f4c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsync.kt @@ -15,6 +15,6 @@ interface PaymentServiceAsync { @JvmOverloads fun create( params: SandboxPaymentCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt index 6aa24d29..13b829d5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/PaymentServiceAsyncImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.PaymentCreateResponse import com.tryfinch.api.models.SandboxPaymentCreateParams import java.util.concurrent.CompletableFuture -class PaymentServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PaymentServiceAsync { +class PaymentServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Add a new sandbox payment */ override fun create( params: SandboxPaymentCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt index 40a4fb8a..9b1de597 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsync.kt @@ -17,7 +17,7 @@ interface AccountServiceAsync { @JvmOverloads fun create( params: SandboxConnectionAccountCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @@ -27,6 +27,6 @@ interface AccountServiceAsync { @JvmOverloads fun update( params: SandboxConnectionAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt index acaf2640..b84f6266 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/connections/AccountServiceAsyncImpl.kt @@ -19,10 +19,8 @@ import com.tryfinch.api.models.SandboxConnectionAccountCreateParams import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams import java.util.concurrent.CompletableFuture -class AccountServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AccountServiceAsync { +class AccountServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + AccountServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Create a new account for an existing connection (company/provider pair) */ override fun create( params: SandboxConnectionAccountCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() @@ -63,7 +61,7 @@ internal constructor( */ override fun update( params: SandboxConnectionAccountUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt index ba1dbde7..e9fa09f4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsync.kt @@ -16,13 +16,13 @@ interface ConfigurationServiceAsync { @JvmOverloads fun retrieve( params: SandboxJobConfigurationRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** Update configurations for sandbox jobs */ @JvmOverloads fun update( params: SandboxJobConfigurationUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt index 3929d315..b3ebe7aa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/sandbox/jobs/ConfigurationServiceAsyncImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams import java.util.concurrent.CompletableFuture -class ConfigurationServiceAsyncImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ConfigurationServiceAsync { +class ConfigurationServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + ConfigurationServiceAsync { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Get configurations for sandbox jobs */ override fun retrieve( params: SandboxJobConfigurationRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture> { val request = HttpRequest.builder() @@ -60,7 +58,7 @@ internal constructor( /** Update configurations for sandbox jobs */ override fun update( params: SandboxJobConfigurationUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt index ad4b8e53..5eb189ed 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenService.kt @@ -14,6 +14,6 @@ interface AccessTokenService { @JvmOverloads fun create( params: AccessTokenCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CreateAccessTokenResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt index 00fb601b..d1bab69e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccessTokenServiceImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.errors.FinchException import com.tryfinch.api.models.AccessTokenCreateParams import com.tryfinch.api.models.CreateAccessTokenResponse -class AccessTokenServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AccessTokenService { +class AccessTokenServiceImpl internal constructor(private val clientOptions: ClientOptions) : + AccessTokenService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Exchange the authorization code for an access token */ override fun create( params: AccessTokenCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CreateAccessTokenResponse { val builder = params.toBuilder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt index 917a0827..5cc0334d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountService.kt @@ -16,13 +16,13 @@ interface AccountService { @JvmOverloads fun disconnect( params: AccountDisconnectParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DisconnectResponse /** Read account information associated with an `access_token` */ @JvmOverloads fun introspect( params: AccountIntrospectParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Introspection } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt index a636d599..45a7f120 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/AccountServiceImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.AccountIntrospectParams import com.tryfinch.api.models.DisconnectResponse import com.tryfinch.api.models.Introspection -class AccountServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AccountService { +class AccountServiceImpl internal constructor(private val clientOptions: ClientOptions) : + AccountService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Disconnect one or more `access_token`s from your application. */ override fun disconnect( params: AccountDisconnectParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DisconnectResponse { val request = HttpRequest.builder() @@ -56,7 +54,7 @@ internal constructor( /** Read account information associated with an `access_token` */ override fun introspect( params: AccountIntrospectParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Introspection { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt index 33ad8280..52c64ab3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ConnectServiceImpl.kt @@ -6,10 +6,8 @@ import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.services.blocking.connect.SessionService import com.tryfinch.api.services.blocking.connect.SessionServiceImpl -class ConnectServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ConnectService { +class ConnectServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectService { private val sessions: SessionService by lazy { SessionServiceImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt index 7815bd7c..78b7de0a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisServiceImpl.kt @@ -20,10 +20,7 @@ import com.tryfinch.api.services.blocking.hris.PayStatementServiceImpl import com.tryfinch.api.services.blocking.hris.PaymentService import com.tryfinch.api.services.blocking.hris.PaymentServiceImpl -class HrisServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : HrisService { +class HrisServiceImpl internal constructor(private val clientOptions: ClientOptions) : HrisService { private val company: CompanyService by lazy { CompanyServiceImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt index e66f9efc..29bdd632 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/JobServiceImpl.kt @@ -8,10 +8,7 @@ import com.tryfinch.api.services.blocking.jobs.AutomatedServiceImpl import com.tryfinch.api.services.blocking.jobs.ManualService import com.tryfinch.api.services.blocking.jobs.ManualServiceImpl -class JobServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : JobService { +class JobServiceImpl internal constructor(private val clientOptions: ClientOptions) : JobService { private val automated: AutomatedService by lazy { AutomatedServiceImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt index 574b007b..ca423f3d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/PayrollServiceImpl.kt @@ -6,10 +6,8 @@ import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.services.blocking.payroll.PayGroupService import com.tryfinch.api.services.blocking.payroll.PayGroupServiceImpl -class PayrollServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PayrollService { +class PayrollServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PayrollService { private val payGroups: PayGroupService by lazy { PayGroupServiceImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt index 5573b3a1..9c534a0d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderService.kt @@ -14,6 +14,6 @@ interface ProviderService { @JvmOverloads fun list( params: ProviderListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ProviderListPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt index e27d7069..b74c1193 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.models.Provider import com.tryfinch.api.models.ProviderListPage import com.tryfinch.api.models.ProviderListParams -class ProviderServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ProviderService { +class ProviderServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ProviderService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,7 +27,7 @@ internal constructor( /** Return details on all available payroll and HR systems. */ override fun list( params: ProviderListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ProviderListPage { val request = HttpRequest.builder() @@ -49,7 +47,7 @@ internal constructor( ProviderListPage.of( this, params, - ProviderListPage.Response.builder().items(it).build() + ProviderListPage.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt index db08ee9b..7bcd0174 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingService.kt @@ -18,6 +18,6 @@ interface RequestForwardingService { @JvmOverloads fun forward( params: RequestForwardingForwardParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): RequestForwardingForwardResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt index 7b041fc3..8121df1d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/RequestForwardingServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.RequestForwardingForwardParams import com.tryfinch.api.models.RequestForwardingForwardResponse -class RequestForwardingServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : RequestForwardingService { +class RequestForwardingServiceImpl internal constructor(private val clientOptions: ClientOptions) : + RequestForwardingService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +32,7 @@ internal constructor( */ override fun forward( params: RequestForwardingForwardParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): RequestForwardingForwardResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt index e93cb9d6..7eeca782 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/SandboxServiceImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.services.blocking.sandbox.JobServiceImpl import com.tryfinch.api.services.blocking.sandbox.PaymentService import com.tryfinch.api.services.blocking.sandbox.PaymentServiceImpl -class SandboxServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SandboxService { +class SandboxServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SandboxService { private val connections: ConnectionService by lazy { ConnectionServiceImpl(clientOptions) } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt index 0330cb2e..6cb6f7b2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt @@ -18,10 +18,8 @@ import java.util.Base64 import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec -class WebhookServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : WebhookService { +class WebhookServiceImpl internal constructor(private val clientOptions: ClientOptions) : + WebhookService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt index 7c2dcf4b..dc3e860f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionService.kt @@ -16,13 +16,13 @@ interface SessionService { @JvmOverloads fun new_( params: ConnectSessionNewParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SessionNewResponse /** Create a new Connect session for reauthenticating an existing connection */ @JvmOverloads fun reauthenticate( params: ConnectSessionReauthenticateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SessionReauthenticateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt index 5bd2beaf..98ac5eb3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/connect/SessionServiceImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.ConnectSessionReauthenticateParams import com.tryfinch.api.models.SessionNewResponse import com.tryfinch.api.models.SessionReauthenticateResponse -class SessionServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : SessionService { +class SessionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + SessionService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Create a new connect session for an employer */ override fun new_( params: ConnectSessionNewParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SessionNewResponse { val request = HttpRequest.builder() @@ -57,7 +55,7 @@ internal constructor( /** Create a new Connect session for reauthenticating an existing connection */ override fun reauthenticate( params: ConnectSessionReauthenticateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SessionReauthenticateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt index 047a9412..1c6a96e2 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitService.kt @@ -28,34 +28,34 @@ interface BenefitService { @JvmOverloads fun create( params: HrisBenefitCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CreateCompanyBenefitsResponse /** Lists deductions and contributions information for a given item */ @JvmOverloads fun retrieve( params: HrisBenefitRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompanyBenefit /** Updates an existing company-wide deduction or contribution */ @JvmOverloads fun update( params: HrisBenefitUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): UpdateCompanyBenefitResponse /** List all company-wide deductions and contributions. */ @JvmOverloads fun list( params: HrisBenefitListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitListPage /** Get deductions metadata */ @JvmOverloads fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitListSupportedBenefitsPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index 2cd734de..212bc6bc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -27,10 +27,8 @@ import com.tryfinch.api.models.UpdateCompanyBenefitResponse import com.tryfinch.api.services.blocking.hris.benefits.IndividualService import com.tryfinch.api.services.blocking.hris.benefits.IndividualServiceImpl -class BenefitServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : BenefitService { +class BenefitServiceImpl internal constructor(private val clientOptions: ClientOptions) : + BenefitService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -48,7 +46,7 @@ internal constructor( */ override fun create( params: HrisBenefitCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CreateCompanyBenefitsResponse { val request = HttpRequest.builder() @@ -73,7 +71,7 @@ internal constructor( /** Lists deductions and contributions information for a given item */ override fun retrieve( params: HrisBenefitRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompanyBenefit { val request = HttpRequest.builder() @@ -98,7 +96,7 @@ internal constructor( /** Updates an existing company-wide deduction or contribution */ override fun update( params: HrisBenefitUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): UpdateCompanyBenefitResponse { val request = HttpRequest.builder() @@ -123,7 +121,7 @@ internal constructor( /** List all company-wide deductions and contributions. */ override fun list( params: HrisBenefitListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisBenefitListPage { val request = HttpRequest.builder() @@ -143,7 +141,7 @@ internal constructor( HrisBenefitListPage.of( this, params, - HrisBenefitListPage.Response.builder().items(it).build() + HrisBenefitListPage.Response.builder().items(it).build(), ) } } @@ -154,7 +152,7 @@ internal constructor( /** Get deductions metadata */ override fun listSupportedBenefits( params: HrisBenefitListSupportedBenefitsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisBenefitListSupportedBenefitsPage { val request = HttpRequest.builder() @@ -174,7 +172,7 @@ internal constructor( HrisBenefitListSupportedBenefitsPage.of( this, params, - HrisBenefitListSupportedBenefitsPage.Response.builder().items(it).build() + HrisBenefitListSupportedBenefitsPage.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt index 5597c793..e14f27cd 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyService.kt @@ -14,6 +14,6 @@ interface CompanyService { @JvmOverloads fun retrieve( params: HrisCompanyRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): Company } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt index 46b695b3..f8642c39 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/CompanyServiceImpl.kt @@ -15,10 +15,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.Company import com.tryfinch.api.models.HrisCompanyRetrieveParams -class CompanyServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CompanyService { +class CompanyServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -28,7 +26,7 @@ internal constructor( /** Read basic company data */ override fun retrieve( params: HrisCompanyRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): Company { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt index 8c8e64c0..5223328e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryService.kt @@ -16,7 +16,7 @@ interface DirectoryService { @JvmOverloads fun list( params: HrisDirectoryListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisDirectoryListPage /** Read company directory and organization structure */ @@ -24,6 +24,6 @@ interface DirectoryService { @JvmOverloads fun listIndividuals( params: HrisDirectoryListIndividualsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisDirectoryListIndividualsPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt index 5d98caa5..d20b1bcf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.HrisDirectoryListIndividualsParams import com.tryfinch.api.models.HrisDirectoryListPage import com.tryfinch.api.models.HrisDirectoryListParams -class DirectoryServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DirectoryService { +class DirectoryServiceImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Read company directory and organization structure */ override fun list( params: HrisDirectoryListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisDirectoryListPage { val request = HttpRequest.builder() @@ -58,7 +56,7 @@ internal constructor( @Deprecated("use `list` instead") override fun listIndividuals( params: HrisDirectoryListIndividualsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisDirectoryListIndividualsPage { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt index fc30aa9a..3e06ad08 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt @@ -18,7 +18,7 @@ interface DocumentService { @JvmOverloads fun list( params: HrisDocumentListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DocumentListResponse /** @@ -28,6 +28,6 @@ interface DocumentService { @JvmOverloads fun retreive( params: HrisDocumentRetreiveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): DocumentRetreiveResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt index b823de32..fb50f412 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.DocumentRetreiveResponse import com.tryfinch.api.models.HrisDocumentListParams import com.tryfinch.api.models.HrisDocumentRetreiveParams -class DocumentServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DocumentService { +class DocumentServiceImpl internal constructor(private val clientOptions: ClientOptions) : + DocumentService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( */ override fun list( params: HrisDocumentListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DocumentListResponse { val request = HttpRequest.builder() @@ -60,7 +58,7 @@ internal constructor( */ override fun retreive( params: HrisDocumentRetreiveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): DocumentRetreiveResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt index 6252358d..98beeb34 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentService.kt @@ -14,6 +14,6 @@ interface EmploymentService { @JvmOverloads fun retrieveMany( params: HrisEmploymentRetrieveManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisEmploymentRetrieveManyPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt index caa1ddb0..1f65f3bc 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisEmploymentRetrieveManyPage import com.tryfinch.api.models.HrisEmploymentRetrieveManyParams -class EmploymentServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : EmploymentService { +class EmploymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Read individual employment and income data */ override fun retrieveMany( params: HrisEmploymentRetrieveManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisEmploymentRetrieveManyPage { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt index 844f65c8..669e8aa9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt @@ -14,6 +14,6 @@ interface IndividualService { @JvmOverloads fun retrieveMany( params: HrisIndividualRetrieveManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisIndividualRetrieveManyPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt index 1c6acb60..55949402 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisIndividualRetrieveManyPage import com.tryfinch.api.models.HrisIndividualRetrieveManyParams -class IndividualServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : IndividualService { +class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Read individual data, excluding income and employment data */ override fun retrieveMany( params: HrisIndividualRetrieveManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisIndividualRetrieveManyPage { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt index cf337107..aa04af04 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementService.kt @@ -18,6 +18,6 @@ interface PayStatementService { @JvmOverloads fun retrieveMany( params: HrisPayStatementRetrieveManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisPayStatementRetrieveManyPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt index 38bd156c..129ec2f5 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.HrisPayStatementRetrieveManyPage import com.tryfinch.api.models.HrisPayStatementRetrieveManyParams -class PayStatementServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PayStatementService { +class PayStatementServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PayStatementService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -34,7 +32,7 @@ internal constructor( */ override fun retrieveMany( params: HrisPayStatementRetrieveManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisPayStatementRetrieveManyPage { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt index 5b27a625..c1f5ea2d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentService.kt @@ -14,6 +14,6 @@ interface PaymentService { @JvmOverloads fun list( params: HrisPaymentListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisPaymentListPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt index 4f20d692..3fc047c3 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.models.HrisPaymentListPage import com.tryfinch.api.models.HrisPaymentListParams import com.tryfinch.api.models.Payment -class PaymentServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PaymentService { +class PaymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,7 +27,7 @@ internal constructor( /** Read payroll and contractor related payments by the company. */ override fun list( params: HrisPaymentListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisPaymentListPage { val request = HttpRequest.builder() @@ -49,7 +47,7 @@ internal constructor( HrisPaymentListPage.of( this, params, - HrisPaymentListPage.Response.builder().items(it).build() + HrisPaymentListPage.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt index 666da43e..4ca4e5f0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualService.kt @@ -18,20 +18,20 @@ interface IndividualService { @JvmOverloads fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): IndividualEnrolledIdsResponse /** Get enrollment information for the given individuals. */ @JvmOverloads fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitIndividualRetrieveManyBenefitsPage /** Unenroll individuals from a deduction or contribution */ @JvmOverloads fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): HrisBenefitIndividualUnenrollManyPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index 2de79b77..51cb9c63 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -22,10 +22,8 @@ import com.tryfinch.api.models.IndividualBenefit import com.tryfinch.api.models.IndividualEnrolledIdsResponse import com.tryfinch.api.models.UnenrolledIndividual -class IndividualServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : IndividualService { +class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -36,7 +34,7 @@ internal constructor( /** Lists individuals currently enrolled in a given deduction. */ override fun enrolledIds( params: HrisBenefitIndividualEnrolledIdsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): IndividualEnrolledIdsResponse { val request = HttpRequest.builder() @@ -61,7 +59,7 @@ internal constructor( /** Get enrollment information for the given individuals. */ override fun retrieveManyBenefits( params: HrisBenefitIndividualRetrieveManyBenefitsParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisBenefitIndividualRetrieveManyBenefitsPage { val request = HttpRequest.builder() @@ -83,7 +81,7 @@ internal constructor( params, HrisBenefitIndividualRetrieveManyBenefitsPage.Response.builder() .items(it) - .build() + .build(), ) } } @@ -95,7 +93,7 @@ internal constructor( /** Unenroll individuals from a deduction or contribution */ override fun unenrollMany( params: HrisBenefitIndividualUnenrollManyParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HrisBenefitIndividualUnenrollManyPage { val request = HttpRequest.builder() @@ -116,7 +114,7 @@ internal constructor( HrisBenefitIndividualUnenrollManyPage.of( this, params, - HrisBenefitIndividualUnenrollManyPage.Response.builder().items(it).build() + HrisBenefitIndividualUnenrollManyPage.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt index 8f5dd094..dc4e6545 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedService.kt @@ -32,14 +32,14 @@ interface AutomatedService { @JvmOverloads fun create( params: JobAutomatedCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): AutomatedCreateResponse /** Get an automated job by `job_id`. */ @JvmOverloads fun retrieve( params: JobAutomatedRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): AutomatedAsyncJob /** @@ -50,6 +50,6 @@ interface AutomatedService { @JvmOverloads fun list( params: JobAutomatedListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): JobAutomatedListPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt index ac866243..89ff745a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceImpl.kt @@ -20,10 +20,8 @@ import com.tryfinch.api.models.JobAutomatedListPage import com.tryfinch.api.models.JobAutomatedListParams import com.tryfinch.api.models.JobAutomatedRetrieveParams -class AutomatedServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AutomatedService { +class AutomatedServiceImpl internal constructor(private val clientOptions: ClientOptions) : + AutomatedService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -48,13 +46,13 @@ internal constructor( */ override fun create( params: JobAutomatedCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): AutomatedCreateResponse { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("jobs", "automated") - .body(json(clientOptions.jsonMapper, params._body())) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepare(clientOptions, params) val response = clientOptions.httpClient.execute(request, requestOptions) @@ -73,7 +71,7 @@ internal constructor( /** Get an automated job by `job_id`. */ override fun retrieve( params: JobAutomatedRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): AutomatedAsyncJob { val request = HttpRequest.builder() @@ -102,7 +100,7 @@ internal constructor( */ override fun list( params: JobAutomatedListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): JobAutomatedListPage { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt index 835a3702..b6b76e59 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualService.kt @@ -17,6 +17,6 @@ interface ManualService { @JvmOverloads fun retrieve( params: JobManualRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ManualAsyncJob } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt index 27291f16..9ce1917a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/jobs/ManualServiceImpl.kt @@ -15,10 +15,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.JobManualRetrieveParams import com.tryfinch.api.models.ManualAsyncJob -class ManualServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ManualService { +class ManualServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ManualService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( */ override fun retrieve( params: JobManualRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ManualAsyncJob { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt index f7ae892d..660dcb3a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupService.kt @@ -16,13 +16,13 @@ interface PayGroupService { @JvmOverloads fun retrieve( params: PayrollPayGroupRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): PayGroupRetrieveResponse /** Read company pay groups and frequencies */ @JvmOverloads fun list( params: PayrollPayGroupListParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): PayrollPayGroupListPage } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt index 6a494736..f4653cda 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.PayrollPayGroupListPage import com.tryfinch.api.models.PayrollPayGroupListParams import com.tryfinch.api.models.PayrollPayGroupRetrieveParams -class PayGroupServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PayGroupService { +class PayGroupServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PayGroupService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -32,7 +30,7 @@ internal constructor( /** Read information from a single pay group */ override fun retrieve( params: PayrollPayGroupRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): PayGroupRetrieveResponse { val request = HttpRequest.builder() @@ -57,7 +55,7 @@ internal constructor( /** Read company pay groups and frequencies */ override fun list( params: PayrollPayGroupListParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): PayrollPayGroupListPage { val request = HttpRequest.builder() @@ -77,7 +75,7 @@ internal constructor( PayrollPayGroupListPage.of( this, params, - PayrollPayGroupListPage.Response.builder().items(it).build() + PayrollPayGroupListPage.Response.builder().items(it).build(), ) } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt index a6b20bb3..7c7c7238 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyService.kt @@ -14,6 +14,6 @@ interface CompanyService { @JvmOverloads fun update( params: SandboxCompanyUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): CompanyUpdateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt index e2f62a1d..63e3b740 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/CompanyServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.CompanyUpdateResponse import com.tryfinch.api.models.SandboxCompanyUpdateParams -class CompanyServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : CompanyService { +class CompanyServiceImpl internal constructor(private val clientOptions: ClientOptions) : + CompanyService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,7 +27,7 @@ internal constructor( /** Update a sandbox company's data */ override fun update( params: SandboxCompanyUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompanyUpdateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt index 79026f5e..c1bca965 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionService.kt @@ -17,6 +17,6 @@ interface ConnectionService { @JvmOverloads fun create( params: SandboxConnectionCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): ConnectionCreateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt index c0ce13ef..8f8fdd38 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/ConnectionServiceImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.SandboxConnectionCreateParams import com.tryfinch.api.services.blocking.sandbox.connections.AccountService import com.tryfinch.api.services.blocking.sandbox.connections.AccountServiceImpl -class ConnectionServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ConnectionService { +class ConnectionServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ConnectionService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -36,7 +34,7 @@ internal constructor( /** Create a new connection (new company/provider pair) with a new account */ override fun create( params: SandboxConnectionCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): ConnectionCreateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt index cdeb0c1a..fd14c7da 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryService.kt @@ -14,6 +14,6 @@ interface DirectoryService { @JvmOverloads fun create( params: SandboxDirectoryCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): List } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt index 1f992263..acc30e28 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.core.prepare import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.SandboxDirectoryCreateParams -class DirectoryServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : DirectoryService { +class DirectoryServiceImpl internal constructor(private val clientOptions: ClientOptions) : + DirectoryService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,13 +27,13 @@ internal constructor( /** Add new individuals to a sandbox company */ override fun create( params: SandboxDirectoryCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): List { val request = HttpRequest.builder() .method(HttpMethod.POST) .addPathSegments("sandbox", "directory") - .body(json(clientOptions.jsonMapper, params._body())) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() .prepare(clientOptions, params) val response = clientOptions.httpClient.execute(request, requestOptions) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt index c16beaa5..6d26b611 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentService.kt @@ -14,6 +14,6 @@ interface EmploymentService { @JvmOverloads fun update( params: SandboxEmploymentUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): EmploymentUpdateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt index 742a804c..a538224d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.EmploymentUpdateResponse import com.tryfinch.api.models.SandboxEmploymentUpdateParams -class EmploymentServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : EmploymentService { +class EmploymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : + EmploymentService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Update sandbox employment */ override fun update( params: SandboxEmploymentUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): EmploymentUpdateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt index 227ed995..34657b8f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualService.kt @@ -14,6 +14,6 @@ interface IndividualService { @JvmOverloads fun update( params: SandboxIndividualUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): IndividualUpdateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt index 3333a62a..feb15e1f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.IndividualUpdateResponse import com.tryfinch.api.models.SandboxIndividualUpdateParams -class IndividualServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : IndividualService { +class IndividualServiceImpl internal constructor(private val clientOptions: ClientOptions) : + IndividualService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -30,7 +28,7 @@ internal constructor( /** Update sandbox individual */ override fun update( params: SandboxIndividualUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): IndividualUpdateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt index 524c0de0..65e3c055 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobService.kt @@ -17,6 +17,6 @@ interface JobService { @JvmOverloads fun create( params: SandboxJobCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): JobCreateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt index 589c02eb..a2a60c9d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/JobServiceImpl.kt @@ -18,10 +18,7 @@ import com.tryfinch.api.models.SandboxJobCreateParams import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationService import com.tryfinch.api.services.blocking.sandbox.jobs.ConfigurationServiceImpl -class JobServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : JobService { +class JobServiceImpl internal constructor(private val clientOptions: ClientOptions) : JobService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -37,7 +34,7 @@ internal constructor( /** Enqueue a new sandbox job */ override fun create( params: SandboxJobCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): JobCreateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt index 9097dc10..968cafd4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentService.kt @@ -14,6 +14,6 @@ interface PaymentService { @JvmOverloads fun create( params: SandboxPaymentCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): PaymentCreateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt index d8e902a1..61b5783b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceImpl.kt @@ -16,10 +16,8 @@ import com.tryfinch.api.errors.FinchError import com.tryfinch.api.models.PaymentCreateResponse import com.tryfinch.api.models.SandboxPaymentCreateParams -class PaymentServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : PaymentService { +class PaymentServiceImpl internal constructor(private val clientOptions: ClientOptions) : + PaymentService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -29,7 +27,7 @@ internal constructor( /** Add a new sandbox payment */ override fun create( params: SandboxPaymentCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): PaymentCreateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt index 57d84f21..7fbb6b15 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountService.kt @@ -16,7 +16,7 @@ interface AccountService { @JvmOverloads fun create( params: SandboxConnectionAccountCreateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): AccountCreateResponse /** @@ -26,6 +26,6 @@ interface AccountService { @JvmOverloads fun update( params: SandboxConnectionAccountUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): AccountUpdateResponse } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt index d42f5064..6f053eb8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/connections/AccountServiceImpl.kt @@ -18,10 +18,8 @@ import com.tryfinch.api.models.AccountUpdateResponse import com.tryfinch.api.models.SandboxConnectionAccountCreateParams import com.tryfinch.api.models.SandboxConnectionAccountUpdateParams -class AccountServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : AccountService { +class AccountServiceImpl internal constructor(private val clientOptions: ClientOptions) : + AccountService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Create a new account for an existing connection (company/provider pair) */ override fun create( params: SandboxConnectionAccountCreateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): AccountCreateResponse { val request = HttpRequest.builder() @@ -59,7 +57,7 @@ internal constructor( */ override fun update( params: SandboxConnectionAccountUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): AccountUpdateResponse { val request = HttpRequest.builder() diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt index e40e3a80..393f230c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationService.kt @@ -15,13 +15,13 @@ interface ConfigurationService { @JvmOverloads fun retrieve( params: SandboxJobConfigurationRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): List /** Update configurations for sandbox jobs */ @JvmOverloads fun update( params: SandboxJobConfigurationUpdateParams, - requestOptions: RequestOptions = RequestOptions.none() + requestOptions: RequestOptions = RequestOptions.none(), ): SandboxJobConfiguration } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt index 70a26346..08046405 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceImpl.kt @@ -17,10 +17,8 @@ import com.tryfinch.api.models.SandboxJobConfiguration import com.tryfinch.api.models.SandboxJobConfigurationRetrieveParams import com.tryfinch.api.models.SandboxJobConfigurationUpdateParams -class ConfigurationServiceImpl -internal constructor( - private val clientOptions: ClientOptions, -) : ConfigurationService { +class ConfigurationServiceImpl internal constructor(private val clientOptions: ClientOptions) : + ConfigurationService { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) @@ -31,7 +29,7 @@ internal constructor( /** Get configurations for sandbox jobs */ override fun retrieve( params: SandboxJobConfigurationRetrieveParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): List { val request = HttpRequest.builder() @@ -56,7 +54,7 @@ internal constructor( /** Update configurations for sandbox jobs */ override fun update( params: SandboxJobConfigurationUpdateParams, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): SandboxJobConfiguration { val request = HttpRequest.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/TestServerExtension.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/TestServerExtension.kt index d9ec3cdf..5e740846 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/TestServerExtension.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/TestServerExtension.kt @@ -36,7 +36,7 @@ class TestServerExtension : BeforeAllCallback, ExecutionCondition { $ prism mock path/to/your.openapi.yml """ .trimIndent(), - e + e, ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientAsyncTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientAsyncTest.kt index e71b5843..eddacf85 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientAsyncTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientAsyncTest.kt @@ -48,7 +48,7 @@ class FinchClientAsyncTest { "our-client-id", "our-client-secret", "finch-auth-code", - "our-redirect-uri" + "our-redirect-uri", ) .get() ) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientTest.kt index 1d43e67f..9ae63cc9 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/client/FinchClientTest.kt @@ -47,7 +47,7 @@ class FinchClientTest { "our-client-id", "our-client-secret", "finch-auth-code", - "our-redirect-uri" + "our-redirect-uri", ) ) .isEqualTo(expectedToken) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/PhantomReachableTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/PhantomReachableTest.kt index b608618e..02dbac71 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/PhantomReachableTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/PhantomReachableTest.kt @@ -14,7 +14,7 @@ internal class PhantomReachableTest { // Pass an inline object for the object to observe so that it becomes immediately // unreachable. Any(), - closeable + closeable, ) assertThat(closed).isFalse() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ValuesTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ValuesTest.kt new file mode 100644 index 00000000..e5836986 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/ValuesTest.kt @@ -0,0 +1,144 @@ +package com.tryfinch.api.core + +import java.util.Optional +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource + +internal class ValuesTest { + companion object { + private val NON_JSON = Any() + } + + enum class TestCase( + val value: JsonField<*>, + val expectedIsMissing: Boolean = false, + val expectedIsNull: Boolean = false, + val expectedAsKnown: Optional<*> = Optional.empty(), + val expectedAsBoolean: Optional = Optional.empty(), + val expectedAsNumber: Optional = Optional.empty(), + val expectedAsString: Optional = Optional.empty(), + val expectedAsArray: Optional> = Optional.empty(), + val expectedAsObject: Optional> = Optional.empty(), + ) { + MISSING(JsonMissing.of(), expectedIsMissing = true), + NULL(JsonNull.of(), expectedIsNull = true), + KNOWN(KnownValue.of(NON_JSON), expectedAsKnown = Optional.of(NON_JSON)), + KNOWN_BOOLEAN( + KnownValue.of(true), + expectedAsKnown = Optional.of(true), + expectedAsBoolean = Optional.of(true), + ), + BOOLEAN(JsonBoolean.of(true), expectedAsBoolean = Optional.of(true)), + KNOWN_NUMBER( + KnownValue.of(42), + expectedAsKnown = Optional.of(42), + expectedAsNumber = Optional.of(42), + ), + NUMBER(JsonNumber.of(42), expectedAsNumber = Optional.of(42)), + KNOWN_STRING( + KnownValue.of("hello"), + expectedAsKnown = Optional.of("hello"), + expectedAsString = Optional.of("hello"), + ), + STRING(JsonString.of("hello"), expectedAsString = Optional.of("hello")), + KNOWN_ARRAY_NOT_ALL_JSON( + KnownValue.of(listOf("a", "b", NON_JSON)), + expectedAsKnown = Optional.of(listOf("a", "b", NON_JSON)), + ), + KNOWN_ARRAY( + KnownValue.of(listOf("a", "b", "c")), + expectedAsKnown = Optional.of(listOf("a", "b", "c")), + expectedAsArray = + Optional.of(listOf(JsonString.of("a"), JsonString.of("b"), JsonString.of("c"))), + ), + ARRAY( + JsonArray.of(listOf(JsonString.of("a"), JsonString.of("b"), JsonString.of("c"))), + expectedAsArray = + Optional.of(listOf(JsonString.of("a"), JsonString.of("b"), JsonString.of("c"))), + ), + KNOWN_OBJECT_NOT_ALL_STRING_KEYS( + KnownValue.of(mapOf("a" to "b", 42 to "c")), + expectedAsKnown = Optional.of(mapOf("a" to "b", 42 to "c")), + ), + KNOWN_OBJECT_NOT_ALL_JSON( + KnownValue.of(mapOf("a" to "b", "b" to NON_JSON)), + expectedAsKnown = Optional.of(mapOf("a" to "b", "b" to NON_JSON)), + ), + KNOWN_OBJECT( + KnownValue.of(mapOf("a" to "b", "b" to "c")), + expectedAsKnown = Optional.of(mapOf("a" to "b", "b" to "c")), + expectedAsObject = + Optional.of(mapOf("a" to JsonString.of("b"), "b" to JsonString.of("c"))), + ), + OBJECT( + JsonObject.of(mapOf("a" to JsonString.of("b"), "b" to JsonString.of("c"))), + expectedAsObject = + Optional.of(mapOf("a" to JsonString.of("b"), "b" to JsonString.of("c"))), + ), + } + + @ParameterizedTest + @EnumSource + fun isMissing(testCase: TestCase) { + val isMissing = testCase.value.isMissing() + + assertThat(isMissing).isEqualTo(testCase.expectedIsMissing) + } + + @ParameterizedTest + @EnumSource + fun isNull(testCase: TestCase) { + val isNull = testCase.value.isNull() + + assertThat(isNull).isEqualTo(testCase.expectedIsNull) + } + + @ParameterizedTest + @EnumSource + fun asKnown(testCase: TestCase) { + val known = testCase.value.asKnown() + + assertThat(known).isEqualTo(testCase.expectedAsKnown) + } + + @ParameterizedTest + @EnumSource + fun asBoolean(testCase: TestCase) { + val boolean = testCase.value.asBoolean() + + assertThat(boolean).isEqualTo(testCase.expectedAsBoolean) + } + + @ParameterizedTest + @EnumSource + fun asNumber(testCase: TestCase) { + val number = testCase.value.asNumber() + + assertThat(number).isEqualTo(testCase.expectedAsNumber) + } + + @ParameterizedTest + @EnumSource + fun asString(testCase: TestCase) { + val string = testCase.value.asString() + + assertThat(string).isEqualTo(testCase.expectedAsString) + } + + @ParameterizedTest + @EnumSource + fun asArray(testCase: TestCase) { + val array = testCase.value.asArray() + + assertThat(array).isEqualTo(testCase.expectedAsArray) + } + + @ParameterizedTest + @EnumSource + fun asObject(testCase: TestCase) { + val obj = testCase.value.asObject() + + assertThat(obj).isEqualTo(testCase.expectedAsObject) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/HeadersTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/HeadersTest.kt index 9511f5f4..f1611438 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/HeadersTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/HeadersTest.kt @@ -11,28 +11,28 @@ internal class HeadersTest { enum class TestCase( val headers: Headers, val expectedMap: Map>, - val expectedSize: Int + val expectedSize: Int, ) { EMPTY(Headers.builder().build(), expectedMap = mapOf(), expectedSize = 0), PUT_ONE( Headers.builder().put("name", "value").build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_MULTIPLE( Headers.builder().put("name", listOf("value1", "value2")).build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT( Headers.builder().put("name1", "value").put("name2", "value").build(), expectedMap = mapOf("name1" to listOf("value"), "name2" to listOf("value")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_SAME_NAME( Headers.builder().put("name", "value1").put("name", "value2").build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_MULTIPLE( Headers.builder() @@ -40,7 +40,7 @@ internal class HeadersTest { .put("name", listOf("value1", "value2")) .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_CASE_INSENSITIVE( Headers.builder() @@ -49,25 +49,25 @@ internal class HeadersTest { .put("nAmE", "value3") .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value3")), - expectedSize = 3 + expectedSize = 3, ), PUT_ALL_MAP( Headers.builder() .putAll( mapOf( "name1" to listOf("value1", "value2"), - "name2" to listOf("value1", "value2") + "name2" to listOf("value1", "value2"), ) ) .build(), expectedMap = mapOf("name1" to listOf("value1", "value2"), "name2" to listOf("value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_HEADERS( Headers.builder().putAll(Headers.builder().put("name", "value").build()).build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_ALL_CASE_INSENSITIVE( Headers.builder() @@ -75,32 +75,32 @@ internal class HeadersTest { mapOf( "name" to listOf("value1"), "NAME" to listOf("value2"), - "nAmE" to listOf("value3") + "nAmE" to listOf("value3"), ) ) .build(), expectedMap = mapOf("name" to listOf("value1", "value2", "value3")), - expectedSize = 3 + expectedSize = 3, ), REMOVE_ABSENT( Headers.builder().remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_ONE( Headers.builder().put("name", "value").remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_MULTIPLE( Headers.builder().put("name", listOf("value1", "value2")).remove("name").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_CASE_INSENSITIVE( Headers.builder().put("name", listOf("value1", "value2")).remove("NAME").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL( Headers.builder() @@ -109,7 +109,7 @@ internal class HeadersTest { .removeAll(setOf("name1", "name2", "name3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL_CASE_INSENSITIVE( Headers.builder() @@ -118,22 +118,22 @@ internal class HeadersTest { .removeAll(setOf("NAME1", "nAmE3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), CLEAR( Headers.builder().put("name1", "value").put("name2", "value").clear().build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REPLACE_ONE_ABSENT( Headers.builder().replace("name", "value").build(), expectedMap = mapOf("name" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_ONE( Headers.builder().put("name", "value1").replace("name", "value2").build(), expectedMap = mapOf("name" to listOf("value2")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_MULTIPLE( Headers.builder() @@ -141,12 +141,12 @@ internal class HeadersTest { .replace("name", "value3") .build(), expectedMap = mapOf("name" to listOf("value3")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_MULTIPLE_ABSENT( Headers.builder().replace("name", listOf("value1", "value2")).build(), expectedMap = mapOf("name" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_ONE( Headers.builder() @@ -154,7 +154,7 @@ internal class HeadersTest { .replace("name", listOf("value2", "value3")) .build(), expectedMap = mapOf("name" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_MULTIPLE( Headers.builder() @@ -162,7 +162,7 @@ internal class HeadersTest { .replace("name", listOf("value3", "value4")) .build(), expectedMap = mapOf("name" to listOf("value3", "value4")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_CASE_INSENSITIVE( Headers.builder() @@ -170,7 +170,7 @@ internal class HeadersTest { .replace("NAME", listOf("value2", "value3")) .build(), expectedMap = mapOf("NAME" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_ALL_MAP( Headers.builder() @@ -183,9 +183,9 @@ internal class HeadersTest { mapOf( "name1" to listOf("value2"), "name2" to listOf("value1"), - "name3" to listOf("value2") + "name3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_HEADERS( Headers.builder() @@ -198,9 +198,9 @@ internal class HeadersTest { mapOf( "name1" to listOf("value2"), "name2" to listOf("value1"), - "name3" to listOf("value2") + "name3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_CASE_INSENSITIVE( Headers.builder() @@ -209,8 +209,8 @@ internal class HeadersTest { .replaceAll(mapOf("NAME1" to listOf("value2"), "nAmE2" to listOf("value2"))) .build(), expectedMap = mapOf("NAME1" to listOf("value2"), "nAmE2" to listOf("value2")), - expectedSize = 2 - ) + expectedSize = 2, + ), } @ParameterizedTest diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/QueryParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/QueryParamsTest.kt index 302bf7a0..2002ca28 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/QueryParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/QueryParamsTest.kt @@ -11,28 +11,28 @@ internal class QueryParamsTest { enum class TestCase( val queryParams: QueryParams, val expectedMap: Map>, - val expectedSize: Int + val expectedSize: Int, ) { EMPTY(QueryParams.builder().build(), expectedMap = mapOf(), expectedSize = 0), PUT_ONE( QueryParams.builder().put("key", "value").build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), PUT_MULTIPLE( QueryParams.builder().put("key", listOf("value1", "value2")).build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT( QueryParams.builder().put("key1", "value").put("key2", "value").build(), expectedMap = mapOf("key1" to listOf("value"), "key2" to listOf("value")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_SAME_NAME( QueryParams.builder().put("key", "value1").put("key", "value2").build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), MULTIPLE_PUT_MULTIPLE( QueryParams.builder() @@ -40,40 +40,40 @@ internal class QueryParamsTest { .put("key", listOf("value1", "value2")) .build(), expectedMap = mapOf("key" to listOf("value1", "value2", "value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_MAP( QueryParams.builder() .putAll( mapOf( "key1" to listOf("value1", "value2"), - "key2" to listOf("value1", "value2") + "key2" to listOf("value1", "value2"), ) ) .build(), expectedMap = mapOf("key1" to listOf("value1", "value2"), "key2" to listOf("value1", "value2")), - expectedSize = 4 + expectedSize = 4, ), PUT_ALL_HEADERS( QueryParams.builder().putAll(QueryParams.builder().put("key", "value").build()).build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REMOVE_ABSENT( QueryParams.builder().remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_ONE( QueryParams.builder().put("key", "value").remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_PRESENT_MULTIPLE( QueryParams.builder().put("key", listOf("value1", "value2")).remove("key").build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REMOVE_ALL( QueryParams.builder() @@ -82,22 +82,22 @@ internal class QueryParamsTest { .removeAll(setOf("key1", "key2", "key3")) .build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), CLEAR( QueryParams.builder().put("key1", "value").put("key2", "value").clear().build(), expectedMap = mapOf(), - expectedSize = 0 + expectedSize = 0, ), REPLACE_ONE_ABSENT( QueryParams.builder().replace("key", "value").build(), expectedMap = mapOf("key" to listOf("value")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_ONE( QueryParams.builder().put("key", "value1").replace("key", "value2").build(), expectedMap = mapOf("key" to listOf("value2")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_ONE_PRESENT_MULTIPLE( QueryParams.builder() @@ -105,12 +105,12 @@ internal class QueryParamsTest { .replace("key", "value3") .build(), expectedMap = mapOf("key" to listOf("value3")), - expectedSize = 1 + expectedSize = 1, ), REPLACE_MULTIPLE_ABSENT( QueryParams.builder().replace("key", listOf("value1", "value2")).build(), expectedMap = mapOf("key" to listOf("value1", "value2")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_ONE( QueryParams.builder() @@ -118,7 +118,7 @@ internal class QueryParamsTest { .replace("key", listOf("value2", "value3")) .build(), expectedMap = mapOf("key" to listOf("value2", "value3")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_MULTIPLE_PRESENT_MULTIPLE( QueryParams.builder() @@ -126,7 +126,7 @@ internal class QueryParamsTest { .replace("key", listOf("value3", "value4")) .build(), expectedMap = mapOf("key" to listOf("value3", "value4")), - expectedSize = 2 + expectedSize = 2, ), REPLACE_ALL_MAP( QueryParams.builder() @@ -139,9 +139,9 @@ internal class QueryParamsTest { mapOf( "key1" to listOf("value2"), "key2" to listOf("value1"), - "key3" to listOf("value2") + "key3" to listOf("value2"), ), - expectedSize = 3 + expectedSize = 3, ), REPLACE_ALL_HEADERS( QueryParams.builder() @@ -156,10 +156,10 @@ internal class QueryParamsTest { mapOf( "key1" to listOf("value2"), "key2" to listOf("value1"), - "key3" to listOf("value2") + "key3" to listOf("value2"), ), - expectedSize = 3 - ) + expectedSize = 3, + ), } @ParameterizedTest diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/RetryingHttpClientTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/RetryingHttpClientTest.kt index 40ab4321..ae5c8211 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/RetryingHttpClientTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/RetryingHttpClientTest.kt @@ -26,12 +26,12 @@ internal class RetryingHttpClientTest { object : HttpClient { override fun execute( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): HttpResponse = trackClose(okHttpClient.execute(request, requestOptions)) override fun executeAsync( request: HttpRequest, - requestOptions: RequestOptions + requestOptions: RequestOptions, ): CompletableFuture = okHttpClient.executeAsync(request, requestOptions).thenApply { trackClose(it) } @@ -71,7 +71,7 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) @@ -97,7 +97,7 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) @@ -140,24 +140,24 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("0")) + .withHeader("x-stainless-retry-count", equalTo("0")), ) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("1")) + .withHeader("x-stainless-retry-count", equalTo("1")), ) verify( 1, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("2")) + .withHeader("x-stainless-retry-count", equalTo("2")), ) assertNoResponseLeaks() } @@ -191,14 +191,14 @@ internal class RetryingHttpClientTest { .addPathSegment("something") .putHeader("x-stainless-retry-count", "42") .build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) verify( 2, postRequestedFor(urlPathEqualTo("/something")) - .withHeader("x-stainless-retry-count", equalTo("42")) + .withHeader("x-stainless-retry-count", equalTo("42")), ) assertNoResponseLeaks() } @@ -226,7 +226,7 @@ internal class RetryingHttpClientTest { val response = retryingClient.execute( HttpRequest.builder().method(HttpMethod.POST).addPathSegment("something").build(), - async + async, ) assertThat(response.statusCode()).isEqualTo(200) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt index 59d8dece..159fc882 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/core/http/SerializerTest.kt @@ -48,11 +48,7 @@ internal class SerializerTest { override fun hashCode(): Int { if (hashCode == 0) { - hashCode = - Objects.hash( - isActive, - additionalProperties, - ) + hashCode = Objects.hash(isActive, additionalProperties) } return hashCode } @@ -91,10 +87,7 @@ internal class SerializerTest { } fun build(): ClassWithBooleanFieldPrefixedWithIs = - ClassWithBooleanFieldPrefixedWithIs( - isActive, - additionalProperties.toImmutable(), - ) + ClassWithBooleanFieldPrefixedWithIs(isActive, additionalProperties.toImmutable()) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt index a95c01db..3878dc6a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/AccessTokenCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -26,8 +27,10 @@ class AccessTokenCreateParamsTest { .clientSecret("") .redirectUri("https://example.com") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.code()).isEqualTo("") assertThat(body.clientId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.clientSecret()).contains("") @@ -37,8 +40,10 @@ class AccessTokenCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = AccessTokenCreateParams.builder().code("").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.code()).isEqualTo("") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt index fa0cbf4b..ee91137d 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionNewParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -46,8 +47,10 @@ class ConnectSessionNewParamsTest { .redirectUri("redirect_uri") .sandbox(ConnectSessionNewParams.Sandbox.FINCH) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.customerId()).isEqualTo("x") assertThat(body.customerName()).isEqualTo("x") assertThat(body.products()) @@ -74,8 +77,10 @@ class ConnectSessionNewParamsTest { .customerName("x") .addProduct(ConnectSessionNewParams.ConnectProducts.COMPANY) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.customerId()).isEqualTo("x") assertThat(body.customerName()).isEqualTo("x") assertThat(body.products()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt index 8e65bd3a..bd7bdfdc 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/ConnectSessionReauthenticateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -26,8 +27,10 @@ class ConnectSessionReauthenticateParamsTest { .addProduct(ConnectSessionReauthenticateParams.ConnectProducts.COMPANY) .redirectUri("https://example.com") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.connectionId()).isEqualTo("connection_id") assertThat(body.minutesToExpire()).contains(0L) assertThat(body.products()) @@ -39,8 +42,10 @@ class ConnectSessionReauthenticateParamsTest { fun bodyWithoutOptionalFields() { val params = ConnectSessionReauthenticateParams.builder().connectionId("connection_id").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.connectionId()).isEqualTo("connection_id") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt index f2041397..8255a9c7 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -24,8 +25,10 @@ class HrisBenefitCreateParamsTest { .frequency(BenefitFrequency.ONE_TIME) .type(BenefitType._401K) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.description()).contains("description") assertThat(body.frequency()).contains(BenefitFrequency.ONE_TIME) assertThat(body.type()).contains(BenefitType._401K) @@ -34,7 +37,9 @@ class HrisBenefitCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = HrisBenefitCreateParams.builder().build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt index 926ce855..5768f00c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsParamsTest.kt @@ -30,7 +30,7 @@ class HrisBenefitIndividualRetrieveManyBenefitsParamsTest { val expected = QueryParams.builder() expected.put( "individual_ids", - "d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a" + "d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a", ) assertThat(params._queryParams()).isEqualTo(expected.build()) } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt index 4c52c39d..9e007c2a 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitIndividualUnenrollManyParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -22,8 +23,10 @@ class HrisBenefitIndividualUnenrollManyParamsTest { .benefitId("benefit_id") .addIndividualId("string") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.individualIds()).contains(listOf("string")) } @@ -31,8 +34,10 @@ class HrisBenefitIndividualUnenrollManyParamsTest { fun bodyWithoutOptionalFields() { val params = HrisBenefitIndividualUnenrollManyParams.builder().benefitId("benefit_id").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt index f4adeb22..b9074f26 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisBenefitUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -19,16 +20,20 @@ class HrisBenefitUpdateParamsTest { .benefitId("benefit_id") .description("description") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.description()).contains("description") } @Test fun bodyWithoutOptionalFields() { val params = HrisBenefitUpdateParams.builder().benefitId("benefit_id").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt index 2f9ce6e5..c1b825d6 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -28,8 +29,10 @@ class HrisEmploymentRetrieveManyParamsTest { .build() ) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.requests()) .isEqualTo( listOf( @@ -50,8 +53,10 @@ class HrisEmploymentRetrieveManyParamsTest { .build() ) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.requests()) .isEqualTo( listOf( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt index a3e690dd..34340368 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -34,8 +35,10 @@ class HrisIndividualRetrieveManyParamsTest { .build() ) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.options()) .contains( HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() @@ -53,7 +56,9 @@ class HrisIndividualRetrieveManyParamsTest { @Test fun bodyWithoutOptionalFields() { val params = HrisIndividualRetrieveManyParams.builder().build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt index 350813e1..da6b1ccd 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -32,8 +33,10 @@ class HrisPayStatementRetrieveManyParamsTest { .build() ) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.requests()) .isEqualTo( listOf( @@ -54,8 +57,10 @@ class HrisPayStatementRetrieveManyParamsTest { HrisPayStatementRetrieveManyParams.Request.builder().paymentId("string").build() ) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.requests()) .isEqualTo( listOf( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt index 38a4981e..3e50cc29 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/JobAutomatedCreateParamsTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test class JobAutomatedCreateParamsTest { @@ -9,11 +11,41 @@ class JobAutomatedCreateParamsTest { @Test fun create() { JobAutomatedCreateParams.builder() - .forDataSyncAll( - JobAutomatedCreateParams.DataSyncAll.builder() - .type(JobAutomatedCreateParams.DataSyncAll.Type.DATA_SYNC_ALL) + .body( + JobAutomatedCreateParams.Body.DataSyncAll.builder() + .type(JobAutomatedCreateParams.Body.DataSyncAll.Type.DATA_SYNC_ALL) .build() ) .build() } + + @Test + fun body() { + val params = + JobAutomatedCreateParams.builder() + .body( + JobAutomatedCreateParams.Body.DataSyncAll.builder() + .type(JobAutomatedCreateParams.Body.DataSyncAll.Type.DATA_SYNC_ALL) + .build() + ) + .build() + + val body = params._body().getOrNull() + + assertThat(body) + .isEqualTo( + JobAutomatedCreateParams.Body.ofDataSyncAll( + JobAutomatedCreateParams.Body.DataSyncAll.builder() + .type(JobAutomatedCreateParams.Body.DataSyncAll.Type.DATA_SYNC_ALL) + .build() + ) + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = JobAutomatedCreateParams.builder().build() + + val body = params._body().getOrNull() + } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt index f6bfeaa6..554f844e 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseBodyTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,6 +18,15 @@ class PayStatementResponseBodyTest { .addEarning( PayStatement.Earning.builder() .amount(0L) + .attributes( + PayStatement.Earning.Metadata.builder() + .metadata( + PayStatement.Earning.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -26,6 +36,16 @@ class PayStatementResponseBodyTest { .addEmployeeDeduction( PayStatement.EmployeeDeduction.builder() .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .preTax(true) @@ -35,6 +55,16 @@ class PayStatementResponseBodyTest { .addEmployerContribution( PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + PayStatement.EmployerContribution.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) @@ -47,6 +77,15 @@ class PayStatementResponseBodyTest { .addTax( PayStatement.Tax.builder() .amount(0L) + .attributes( + PayStatement.Tax.Metadata.builder() + .metadata( + PayStatement.Tax.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") @@ -67,6 +106,15 @@ class PayStatementResponseBodyTest { .addEarning( PayStatement.Earning.builder() .amount(0L) + .attributes( + PayStatement.Earning.Metadata.builder() + .metadata( + PayStatement.Earning.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -76,6 +124,16 @@ class PayStatementResponseBodyTest { .addEmployeeDeduction( PayStatement.EmployeeDeduction.builder() .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .preTax(true) @@ -85,6 +143,16 @@ class PayStatementResponseBodyTest { .addEmployerContribution( PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + PayStatement.EmployerContribution.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) @@ -97,6 +165,15 @@ class PayStatementResponseBodyTest { .addTax( PayStatement.Tax.builder() .amount(0L) + .attributes( + PayStatement.Tax.Metadata.builder() + .metadata( + PayStatement.Tax.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt index 6b944e36..f01728a1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementResponseTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -19,6 +20,19 @@ class PayStatementResponseTest { .addEarning( PayStatement.Earning.builder() .amount(0L) + .attributes( + PayStatement.Earning.Metadata.builder() + .metadata( + PayStatement.Earning.Metadata.InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -28,6 +42,20 @@ class PayStatementResponseTest { .addEmployeeDeduction( PayStatement.EmployeeDeduction.builder() .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .name("name") .preTax(true) @@ -37,6 +65,20 @@ class PayStatementResponseTest { .addEmployerContribution( PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + PayStatement.EmployerContribution.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) @@ -49,6 +91,19 @@ class PayStatementResponseTest { .addTax( PayStatement.Tax.builder() .amount(0L) + .attributes( + PayStatement.Tax.Metadata.builder() + .metadata( + PayStatement.Tax.Metadata.InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") @@ -74,6 +129,19 @@ class PayStatementResponseTest { .addEarning( PayStatement.Earning.builder() .amount(0L) + .attributes( + PayStatement.Earning.Metadata.builder() + .metadata( + PayStatement.Earning.Metadata.InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -83,6 +151,20 @@ class PayStatementResponseTest { .addEmployeeDeduction( PayStatement.EmployeeDeduction.builder() .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .name("name") .preTax(true) @@ -92,6 +174,20 @@ class PayStatementResponseTest { .addEmployerContribution( PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + PayStatement.EmployerContribution.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) @@ -104,6 +200,18 @@ class PayStatementResponseTest { .addTax( PayStatement.Tax.builder() .amount(0L) + .attributes( + PayStatement.Tax.Metadata.builder() + .metadata( + PayStatement.Tax.Metadata.InnerMetadata.builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt index f6a928ec..4c62f3b0 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/PayStatementTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.JsonValue import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,6 +15,15 @@ class PayStatementTest { .addEarning( PayStatement.Earning.builder() .amount(0L) + .attributes( + PayStatement.Earning.Metadata.builder() + .metadata( + PayStatement.Earning.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -23,6 +33,15 @@ class PayStatementTest { .addEmployeeDeduction( PayStatement.EmployeeDeduction.builder() .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .preTax(true) @@ -32,6 +51,16 @@ class PayStatementTest { .addEmployerContribution( PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + PayStatement.EmployerContribution.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Metadata.InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) @@ -44,6 +73,15 @@ class PayStatementTest { .addTax( PayStatement.Tax.builder() .amount(0L) + .attributes( + PayStatement.Tax.Metadata.builder() + .metadata( + PayStatement.Tax.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") @@ -58,6 +96,15 @@ class PayStatementTest { .containsExactly( PayStatement.Earning.builder() .amount(0L) + .attributes( + PayStatement.Earning.Metadata.builder() + .metadata( + PayStatement.Earning.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -68,6 +115,15 @@ class PayStatementTest { .containsExactly( PayStatement.EmployeeDeduction.builder() .amount(0L) + .attributes( + PayStatement.EmployeeDeduction.Metadata.builder() + .metadata( + PayStatement.EmployeeDeduction.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .preTax(true) @@ -78,6 +134,15 @@ class PayStatementTest { .containsExactly( PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + PayStatement.EmployerContribution.Metadata.builder() + .metadata( + PayStatement.EmployerContribution.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) @@ -93,6 +158,15 @@ class PayStatementTest { .containsExactly( PayStatement.Tax.builder() .amount(0L) + .attributes( + PayStatement.Tax.Metadata.builder() + .metadata( + PayStatement.Tax.Metadata.InnerMetadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt index ed881128..d754bf09 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/RequestForwardingForwardParamsTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -29,8 +30,10 @@ class RequestForwardingForwardParamsTest { .headers(JsonValue.from(mapOf("content-type" to "application/json"))) .params(JsonValue.from(mapOf("showInactive" to true, "humanReadable" to true))) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.method()).isEqualTo("POST") assertThat(body.route()).isEqualTo("/people/search") assertThat(body.data()).isEmpty @@ -44,8 +47,10 @@ class RequestForwardingForwardParamsTest { fun bodyWithoutOptionalFields() { val params = RequestForwardingForwardParams.builder().method("POST").route("/people/search").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.method()).isEqualTo("POST") assertThat(body.route()).isEqualTo("/people/search") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt index 81875a2c..111736a3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxCompanyUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -98,8 +99,10 @@ class SandboxCompanyUpdateParamsTest { .primaryEmail("primary_email") .primaryPhoneNumber("primary_phone_number") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.accounts()) .contains( listOf( @@ -166,8 +169,10 @@ class SandboxCompanyUpdateParamsTest { .primaryEmail("primary_email") .primaryPhoneNumber("primary_phone_number") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.accounts()) .contains(listOf(SandboxCompanyUpdateParams.Account.builder().build())) assertThat(body.departments()) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt index c45fc37e..666843c0 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -28,8 +29,10 @@ class SandboxConnectionAccountCreateParamsTest { ) .addProduct("string") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) @@ -44,8 +47,10 @@ class SandboxConnectionAccountCreateParamsTest { .companyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .providerId("provider_id") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.companyId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(body.providerId()).isEqualTo("provider_id") } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt index c1631000..4a60449c 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionAccountUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,15 +21,19 @@ class SandboxConnectionAccountUpdateParamsTest { SandboxConnectionAccountUpdateParams.builder() .connectionStatus(ConnectionStatusType.PENDING) .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.connectionStatus()).contains(ConnectionStatusType.PENDING) } @Test fun bodyWithoutOptionalFields() { val params = SandboxConnectionAccountUpdateParams.builder().build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt index bee27d5e..1e1fc9ac 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxConnectionCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -26,8 +27,10 @@ class SandboxConnectionCreateParamsTest { .employeeSize(0L) .addProduct("string") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.providerId()).isEqualTo("provider_id") assertThat(body.authenticationType()) .contains(SandboxConnectionCreateParams.AuthenticationType.CREDENTIAL) @@ -38,8 +41,10 @@ class SandboxConnectionCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = SandboxConnectionCreateParams.builder().providerId("provider_id").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.providerId()).isEqualTo("provider_id") } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt index fe0ec6a6..d4b9e47f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxDirectoryCreateParamsTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -25,7 +26,7 @@ class SandboxDirectoryCreateParamsTest { .name("name") .build() ) - .dob("01/01/2000") + .dob("dob") .addEmail( SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() .data("data") @@ -53,7 +54,7 @@ class SandboxDirectoryCreateParamsTest { .encryptedSsn("encrypted_ssn") .endDate("end_date") .ethnicity(SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN) - .firstName("John") + .firstName("first_name") .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) .income( Income.builder() @@ -72,7 +73,7 @@ class SandboxDirectoryCreateParamsTest { .build() ) .isActive(true) - .lastName("Smith") + .lastName("last_name") .latestRehireDate("latest_rehire_date") .location( Location.builder() @@ -142,7 +143,7 @@ class SandboxDirectoryCreateParamsTest { .name("name") .build() ) - .dob("01/01/2000") + .dob("dob") .addEmail( SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() .data("data") @@ -175,7 +176,7 @@ class SandboxDirectoryCreateParamsTest { .ethnicity( SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN ) - .firstName("John") + .firstName("first_name") .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) .income( Income.builder() @@ -194,7 +195,7 @@ class SandboxDirectoryCreateParamsTest { .build() ) .isActive(true) - .lastName("Smith") + .lastName("last_name") .latestRehireDate("latest_rehire_date") .location( Location.builder() @@ -245,8 +246,9 @@ class SandboxDirectoryCreateParamsTest { .build() ) .build() - val body = params._body() - assertThat(body).isNotNull + + val body = params._body().getOrNull() + assertThat(body) .isEqualTo( listOf( @@ -264,7 +266,7 @@ class SandboxDirectoryCreateParamsTest { .name("name") .build() ) - .dob("01/01/2000") + .dob("dob") .addEmail( SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() .data("data") @@ -297,7 +299,7 @@ class SandboxDirectoryCreateParamsTest { .ethnicity( SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN ) - .firstName("John") + .firstName("first_name") .gender(SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE) .income( Income.builder() @@ -316,7 +318,7 @@ class SandboxDirectoryCreateParamsTest { .build() ) .isActive(true) - .lastName("Smith") + .lastName("last_name") .latestRehireDate("latest_rehire_date") .location( Location.builder() @@ -371,15 +373,8 @@ class SandboxDirectoryCreateParamsTest { @Test fun bodyWithoutOptionalFields() { - val params = - SandboxDirectoryCreateParams.builder() - .addBody(SandboxDirectoryCreateParams.IndividualOrEmployment.builder().build()) - .build() - val body = params._body() - assertThat(body).isNotNull - assertThat(body) - .isEqualTo( - listOf(SandboxDirectoryCreateParams.IndividualOrEmployment.builder().build()) - ) + val params = SandboxDirectoryCreateParams.builder().build() + + val body = params._body().getOrNull() } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt index 1ea5c35c..6e2e0112 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxEmploymentUpdateParamsTest.kt @@ -3,6 +3,7 @@ package com.tryfinch.api.models import com.tryfinch.api.core.JsonValue +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -63,7 +64,7 @@ class SandboxEmploymentUpdateParamsTest { .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) .middleName("middle_name") .sourceId("source_id") - .startDate("3/4/2020") + .startDate("start_date") .title("title") .build() } @@ -124,11 +125,13 @@ class SandboxEmploymentUpdateParamsTest { .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) .middleName("middle_name") .sourceId("source_id") - .startDate("3/4/2020") + .startDate("start_date") .title("title") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.classCode()).contains("class_code") assertThat(body.customFields()) .contains( @@ -192,15 +195,17 @@ class SandboxEmploymentUpdateParamsTest { .contains(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) assertThat(body.middleName()).contains("middle_name") assertThat(body.sourceId()).contains("source_id") - assertThat(body.startDate()).contains("3/4/2020") + assertThat(body.startDate()).contains("start_date") assertThat(body.title()).contains("title") } @Test fun bodyWithoutOptionalFields() { val params = SandboxEmploymentUpdateParams.builder().individualId("individual_id").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt index 48d7af5d..28ebe7b1 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxIndividualUpdateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -11,7 +12,7 @@ class SandboxIndividualUpdateParamsTest { fun create() { SandboxIndividualUpdateParams.builder() .individualId("individual_id") - .dob("12/20/1989") + .dob("dob") .addEmail( SandboxIndividualUpdateParams.Email.builder() .data("data") @@ -52,7 +53,7 @@ class SandboxIndividualUpdateParamsTest { val params = SandboxIndividualUpdateParams.builder() .individualId("individual_id") - .dob("12/20/1989") + .dob("dob") .addEmail( SandboxIndividualUpdateParams.Email.builder() .data("data") @@ -86,9 +87,11 @@ class SandboxIndividualUpdateParamsTest { ) .ssn("ssn") .build() + val body = params._body() - assertThat(body).isNotNull - assertThat(body.dob()).contains("12/20/1989") + + assertNotNull(body) + assertThat(body.dob()).contains("dob") assertThat(body.emails()) .contains( listOf( @@ -133,8 +136,10 @@ class SandboxIndividualUpdateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = SandboxIndividualUpdateParams.builder().individualId("individual_id").build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } @Test diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt index 3c59ffb1..6c748f9b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobConfigurationUpdateParamsTest.kt @@ -10,8 +10,12 @@ class SandboxJobConfigurationUpdateParamsTest { @Test fun create() { SandboxJobConfigurationUpdateParams.builder() - .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) - .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .sandboxJobConfiguration( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) .build() } @@ -19,27 +23,45 @@ class SandboxJobConfigurationUpdateParamsTest { fun body() { val params = SandboxJobConfigurationUpdateParams.builder() - .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) - .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .sandboxJobConfiguration( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) .build() + val body = params._body() - assertThat(body).isNotNull - assertThat(body.completionStatus()) - .isEqualTo(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) - assertThat(body.type()).isEqualTo(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + + assertThat(body) + .isEqualTo( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) } @Test fun bodyWithoutOptionalFields() { val params = SandboxJobConfigurationUpdateParams.builder() - .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) - .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .sandboxJobConfiguration( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) .build() + val body = params._body() - assertThat(body).isNotNull - assertThat(body.completionStatus()) - .isEqualTo(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) - assertThat(body.type()).isEqualTo(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + + assertThat(body) + .isEqualTo( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt index 8ff44be2..1cd761ec 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxJobCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -16,8 +17,10 @@ class SandboxJobCreateParamsTest { fun body() { val params = SandboxJobCreateParams.builder().type(SandboxJobCreateParams.Type.DATA_SYNC_ALL).build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.type()).isEqualTo(SandboxJobCreateParams.Type.DATA_SYNC_ALL) } @@ -25,8 +28,10 @@ class SandboxJobCreateParamsTest { fun bodyWithoutOptionalFields() { val params = SandboxJobCreateParams.builder().type(SandboxJobCreateParams.Type.DATA_SYNC_ALL).build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.type()).isEqualTo(SandboxJobCreateParams.Type.DATA_SYNC_ALL) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt index dbc9d664..3e1a17b4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/SandboxPaymentCreateParamsTest.kt @@ -2,6 +2,8 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.JsonValue +import kotlin.test.assertNotNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -16,6 +18,17 @@ class SandboxPaymentCreateParamsTest { .addEarning( SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata.builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -24,9 +37,22 @@ class SandboxPaymentCreateParamsTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(2000L) - .currency("usd") - .name("401k test") + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .currency("currency") + .name("name") .preTax(true) .type(BenefitType._401K) .build() @@ -34,18 +60,43 @@ class SandboxPaymentCreateParamsTest { .addEmployerContribution( SandboxPaymentCreateParams.PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") + .individualId("individual_id") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata.builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") @@ -70,6 +121,18 @@ class SandboxPaymentCreateParamsTest { .addEarning( SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -78,9 +141,24 @@ class SandboxPaymentCreateParamsTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(2000L) - .currency("usd") - .name("401k test") + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .currency("currency") + .name("name") .preTax(true) .type(BenefitType._401K) .build() @@ -88,18 +166,44 @@ class SandboxPaymentCreateParamsTest { .addEmployerContribution( SandboxPaymentCreateParams.PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") + .individualId("individual_id") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata.builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") @@ -112,8 +216,10 @@ class SandboxPaymentCreateParamsTest { ) .startDate("start_date") .build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) assertThat(body.endDate()).contains("end_date") assertThat(body.payStatements()) .contains( @@ -122,6 +228,18 @@ class SandboxPaymentCreateParamsTest { .addEarning( SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -130,9 +248,24 @@ class SandboxPaymentCreateParamsTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(2000L) - .currency("usd") - .name("401k test") + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) + .currency("currency") + .name("name") .preTax(true) .type(BenefitType._401K) .build() @@ -140,18 +273,44 @@ class SandboxPaymentCreateParamsTest { .addEmployerContribution( SandboxPaymentCreateParams.PayStatement.EmployerContribution.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") + .individualId("individual_id") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod(SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK) .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata.builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") @@ -169,7 +328,9 @@ class SandboxPaymentCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = SandboxPaymentCreateParams.builder().build() + val body = params._body() - assertThat(body).isNotNull + + assertNotNull(body) } } diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt index c76df6e8..a51b273f 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/ErrorHandlingTest.kt @@ -181,7 +181,7 @@ class ErrorHandlingTest { assertUnprocessableEntity( e, Headers.builder().put("Foo", "Bar").build(), - FINCH_ERROR + FINCH_ERROR, ) }) } @@ -231,7 +231,7 @@ class ErrorHandlingTest { e, 999, Headers.builder().put("Foo", "Bar").build(), - toJson(FINCH_ERROR) + toJson(FINCH_ERROR), ) }) } @@ -270,7 +270,7 @@ class ErrorHandlingTest { throwable: Throwable, statusCode: Int, headers: Headers, - responseBody: ByteArray + responseBody: ByteArray, ) { assertThat(throwable) .asInstanceOf( @@ -328,7 +328,7 @@ class ErrorHandlingTest { private fun assertUnprocessableEntity( throwable: Throwable, headers: Headers, - error: FinchError + error: FinchError, ) { assertThat(throwable) .asInstanceOf( diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/WebhookServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/WebhookServiceTest.kt index fb41874d..794772ee 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/WebhookServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/WebhookServiceTest.kt @@ -70,7 +70,7 @@ class WebhookServiceTest { .put("finch-timestamp", "1676312022") .put("finch-signature", "v1,$webhookSignature") .build(), - null + null, ) } .isInstanceOf(FinchException::class.java) @@ -86,7 +86,7 @@ class WebhookServiceTest { .put("finch-timestamp", "1676312742") .put("finch-signature", "v1,$webhookSignature") .build(), - null + null, ) } .isInstanceOf(FinchException::class.java) @@ -110,7 +110,7 @@ class WebhookServiceTest { .put("finch-timestamp", webhookTimestamp) .put("finch-signature", "v1,$webhookSignature v1,Zm9v") .build(), - null + null, ) } .doesNotThrowAnyException() @@ -125,7 +125,7 @@ class WebhookServiceTest { .put("finch-timestamp", webhookTimestamp) .put("finch-signature", "v2,$webhookSignature") .build(), - null + null, ) } .isInstanceOf(FinchException::class.java) @@ -141,7 +141,7 @@ class WebhookServiceTest { .put("finch-timestamp", webhookTimestamp) .put("finch-signature", "v1,$webhookSignature v2,$webhookSignature") .build(), - null + null, ) } .doesNotThrowAnyException() @@ -156,7 +156,7 @@ class WebhookServiceTest { .put("finch-timestamp", webhookTimestamp) .put("finch-signature", webhookSignature) .build(), - null + null, ) } .isInstanceOf(FinchException::class.java) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt index 79cba36e..dd612542 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/jobs/AutomatedServiceTest.kt @@ -24,9 +24,9 @@ class AutomatedServiceTest { val automatedCreateResponse = automatedService.create( JobAutomatedCreateParams.builder() - .forDataSyncAll( - JobAutomatedCreateParams.DataSyncAll.builder() - .type(JobAutomatedCreateParams.DataSyncAll.Type.DATA_SYNC_ALL) + .body( + JobAutomatedCreateParams.Body.DataSyncAll.builder() + .type(JobAutomatedCreateParams.Body.DataSyncAll.Type.DATA_SYNC_ALL) .build() ) .build() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt index 013e7140..b236df8b 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/DirectoryServiceTest.kt @@ -41,7 +41,7 @@ class DirectoryServiceTest { .name("name") .build() ) - .dob("01/01/2000") + .dob("dob") .addEmail( SandboxDirectoryCreateParams.IndividualOrEmployment.Email.builder() .data("data") @@ -78,7 +78,7 @@ class DirectoryServiceTest { .ethnicity( SandboxDirectoryCreateParams.IndividualOrEmployment.Ethnicity.ASIAN ) - .firstName("John") + .firstName("first_name") .gender( SandboxDirectoryCreateParams.IndividualOrEmployment.Gender.FEMALE ) @@ -99,7 +99,7 @@ class DirectoryServiceTest { .build() ) .isActive(true) - .lastName("Smith") + .lastName("last_name") .latestRehireDate("latest_rehire_date") .location( Location.builder() diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt index aaeef4d7..0fbd8fd4 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/EmploymentServiceTest.kt @@ -79,7 +79,7 @@ class EmploymentServiceTest { .manager(SandboxEmploymentUpdateParams.Manager.builder().id("id").build()) .middleName("middle_name") .sourceId("source_id") - .startDate("3/4/2020") + .startDate("start_date") .title("title") .build() ) diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt index 5e6c4be6..f2aca632 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/IndividualServiceTest.kt @@ -24,7 +24,7 @@ class IndividualServiceTest { individualService.update( SandboxIndividualUpdateParams.builder() .individualId("individual_id") - .dob("12/20/1989") + .dob("dob") .addEmail( SandboxIndividualUpdateParams.Email.builder() .data("data") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt index bbdc3623..a9a6c9e3 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/PaymentServiceTest.kt @@ -4,6 +4,7 @@ package com.tryfinch.api.services.blocking.sandbox import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.core.JsonValue import com.tryfinch.api.models.BenefitType import com.tryfinch.api.models.Money import com.tryfinch.api.models.SandboxPaymentCreateParams @@ -30,6 +31,22 @@ class PaymentServiceTest { .addEarning( SandboxPaymentCreateParams.PayStatement.Earning.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Earning.Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Earning + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .hours(0.0) .name("name") @@ -40,9 +57,27 @@ class PaymentServiceTest { ) .addEmployeeDeduction( SandboxPaymentCreateParams.PayStatement.EmployeeDeduction.builder() - .amount(2000L) - .currency("usd") - .name("401k test") + .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployeeDeduction + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployeeDeduction + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) + .currency("currency") + .name("name") .preTax(true) .type(BenefitType._401K) .build() @@ -51,13 +86,31 @@ class PaymentServiceTest { SandboxPaymentCreateParams.PayStatement.EmployerContribution .builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.EmployerContribution + .Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement + .EmployerContribution + .Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .name("name") .type(BenefitType._401K) .build() ) .grossPay(Money.builder().amount(0L).currency("currency").build()) - .individualId("b2338cfb-472f-4f72-9faa-e028c083144a") + .individualId("individual_id") .netPay(Money.builder().amount(0L).currency("currency").build()) .paymentMethod( SandboxPaymentCreateParams.PayStatement.PaymentMethod.CHECK @@ -65,6 +118,21 @@ class PaymentServiceTest { .addTax( SandboxPaymentCreateParams.PayStatement.Tax.builder() .amount(0L) + .attributes( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata + .builder() + .metadata( + SandboxPaymentCreateParams.PayStatement.Tax.Metadata + .InnerMetadata + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("bar"), + ) + .build() + ) + .build() + ) .currency("currency") .employer(true) .name("name") diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt index 75f0e90c..d7c74124 100644 --- a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/sandbox/jobs/ConfigurationServiceTest.kt @@ -40,8 +40,12 @@ class ConfigurationServiceTest { val sandboxJobConfiguration = configurationService.update( SandboxJobConfigurationUpdateParams.builder() - .completionStatus(SandboxJobConfigurationUpdateParams.CompletionStatus.COMPLETE) - .type(SandboxJobConfigurationUpdateParams.Type.DATA_SYNC_ALL) + .sandboxJobConfiguration( + SandboxJobConfiguration.builder() + .completionStatus(SandboxJobConfiguration.CompletionStatus.COMPLETE) + .type(SandboxJobConfiguration.Type.DATA_SYNC_ALL) + .build() + ) .build() ) println(sandboxJobConfiguration) diff --git a/gradle.properties b/gradle.properties index a3bc58f2..0c8d4ded 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,5 @@ org.gradle.caching=true -org.gradle.jvmargs=-Xmx4g org.gradle.parallel=true +org.gradle.daemon=false +org.gradle.jvmargs=-Xmx4g kotlin.daemon.jvmargs=-Xmx4g diff --git a/scripts/format b/scripts/format index c6239fab..456a69db 100755 --- a/scripts/format +++ b/scripts/format @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running spotlessApply" -./gradlew --build-cache --parallel --no-daemon spotlessApply +./gradlew spotlessApply diff --git a/scripts/lint b/scripts/lint index 58753d0b..e3a5f5e2 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Build classes" -./gradlew --build-cache --parallel --no-daemon build testClasses -x test +./gradlew build testClasses -x test diff --git a/scripts/test b/scripts/test index 72ed0333..6b750a74 100755 --- a/scripts/test +++ b/scripts/test @@ -53,4 +53,4 @@ else fi echo "==> Running tests" -./gradlew --build-cache --parallel --no-daemon test +./gradlew test