diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9695e0ec5..dcb585677 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "9.1.0" + ".": "9.2.0" } diff --git a/.stats.yml b/.stats.yml index 861514c9d..6d130acda 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 48 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch/finch-3cd1346947fabfca2aa9c6f821170c8d945a82667fb20a15644d5c77f8e98c10.yml -openapi_spec_hash: 642e04e90d37c0e4875d154abd06eb54 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch/finch-a6b05e51c46366a54466c2009f5fdde74e0fa40bbcc6568601a4e3342dd16937.yml +openapi_spec_hash: 084797c220144df17d98eb984dd4cba2 config_hash: 9ae56f40cec7304896138bfad5caf748 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8734bfbd8..95332ea3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 9.2.0 (2026-07-13) + +Full Changelog: [v9.1.0...v9.2.0](https://github.com/Finch-API/finch-api-kotlin/compare/v9.1.0...v9.2.0) + +### Features + +* **api:** api update ([4a6f6cb](https://github.com/Finch-API/finch-api-kotlin/commit/4a6f6cba55f5db5b363a8ef37ed7e6d86fbc2cf4)) + ## 9.1.0 (2026-07-01) Full Changelog: [v9.0.0...v9.1.0](https://github.com/Finch-API/finch-api-kotlin/compare/v9.0.0...v9.1.0) diff --git a/README.md b/README.md index 4071b51cb..ecb969e47 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-kotlin)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-kotlin/9.1.0) -[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-kotlin/9.1.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-kotlin/9.1.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-kotlin)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-kotlin/9.2.0) +[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-kotlin/9.2.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-kotlin/9.2.0) @@ -24,7 +24,7 @@ Use the Finch MCP Server to enable AI assistants to interact with this API, allo -The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). KDocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-kotlin/9.1.0). +The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). KDocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-kotlin/9.2.0). @@ -35,7 +35,7 @@ The REST API documentation can be found on [developer.tryfinch.com](https://deve ### Gradle ```kotlin -implementation("com.tryfinch.api:finch-kotlin:9.1.0") +implementation("com.tryfinch.api:finch-kotlin:9.2.0") ``` ### Maven @@ -44,7 +44,7 @@ implementation("com.tryfinch.api:finch-kotlin:9.1.0") com.tryfinch.api finch-kotlin - 9.1.0 + 9.2.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 529882ff7..13ae9be90 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.tryfinch.api" - version = "9.1.0" // x-release-please-version + version = "9.2.0" // x-release-please-version } subprojects { diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt index dcc768a7c..da9343078 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParams.kt @@ -22,7 +22,7 @@ private constructor( /** The entity IDs to specify which entities' data to access. */ fun entityIds(): List? = entityIds - /** Number of employees to return (defaults to all) */ + /** Number of employees to return (defaults to 100, maximum 10000) */ fun limit(): Long? = limit /** Index to start from (defaults to 0) */ @@ -80,7 +80,7 @@ private constructor( entityIds = (entityIds ?: mutableListOf()).apply { add(entityId) } } - /** Number of employees to return (defaults to all) */ + /** Number of employees to return (defaults to 100, maximum 10000) */ fun limit(limit: Long?) = apply { this.limit = limit } /** diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt index 60ed86432..8d6cc728c 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListParams.kt @@ -21,7 +21,7 @@ private constructor( /** The entity IDs to specify which entities' data to access. */ fun entityIds(): List? = entityIds - /** Number of employees to return (defaults to all) */ + /** Number of employees to return (defaults to 100, maximum 10000) */ fun limit(): Long? = limit /** Index to start from (defaults to 0) */ @@ -74,7 +74,7 @@ private constructor( entityIds = (entityIds ?: mutableListOf()).apply { add(entityId) } } - /** Number of employees to return (defaults to all) */ + /** Number of employees to return (defaults to 100, maximum 10000) */ fun limit(limit: Long?) = apply { this.limit = limit } /** diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt index d16e01c40..5586ecc4d 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyParams.kt @@ -33,7 +33,7 @@ private constructor( fun entityIds(): List? = entityIds /** - * The array of batch requests. + * The array of batch requests. Maximum 10000 items per request. * * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -111,7 +111,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** The array of batch requests. */ + /** The array of batch requests. Maximum 10000 items per request. */ fun requests(requests: List) = apply { body.requests(requests) } /** @@ -296,7 +296,7 @@ private constructor( ) : this(requests, mutableMapOf()) /** - * The array of batch requests. + * The array of batch requests. Maximum 10000 items per request. * * @throws FinchInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -348,7 +348,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** The array of batch requests. */ + /** The array of batch requests. Maximum 10000 items per request. */ fun requests(requests: List) = requests(JsonField.of(requests)) /** @@ -481,9 +481,7 @@ private constructor( ) : this(individualId, mutableMapOf()) /** - * A stable Finch `id` (UUID v4) for an individual in the company. There is no limit to the - * number of `individual_id` to send per request. It is preferantial to send all ids in a - * single request for Finch to optimize provider rate-limits. + * A stable Finch `id` (UUID v4) for an individual in the company. * * @throws FinchInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -536,11 +534,7 @@ private constructor( additionalProperties = request.additionalProperties.toMutableMap() } - /** - * A stable Finch `id` (UUID v4) for an individual in the company. There is no limit to - * the number of `individual_id` to send per request. It is preferantial to send all ids - * in a single request for Finch to optimize provider rate-limits. - */ + /** A stable Finch `id` (UUID v4) for an individual in the company. */ fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt index a23e88c1a..2c70f22f7 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParams.kt @@ -12,6 +12,7 @@ import com.tryfinch.api.core.JsonMissing import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.Params import com.tryfinch.api.core.checkKnown +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.core.http.Headers import com.tryfinch.api.core.http.QueryParams import com.tryfinch.api.core.toImmutable @@ -32,30 +33,32 @@ private constructor( fun entityIds(): List? = entityIds /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * The array of batch requests. Maximum 10000 items per request. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly + * missing or null (e.g. if the server responded with an unexpected value). */ - fun options(): Options? = body.options() + fun requests(): List = body.requests() /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun requests(): List? = body.requests() + fun options(): Options? = body.options() /** - * Returns the raw JSON value of [options]. + * Returns the raw JSON value of [requests]. * - * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. */ - fun _options(): JsonField = body._options() + fun _requests(): JsonField> = body._requests() /** - * Returns the raw JSON value of [requests]. + * Returns the raw JSON value of [options]. * - * Unlike [requests], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. */ - fun _requests(): JsonField> = body._requests() + fun _options(): JsonField = body._options() fun _additionalBodyProperties(): Map = body._additionalProperties() @@ -69,11 +72,14 @@ private constructor( companion object { - fun none(): HrisIndividualRetrieveManyParams = builder().build() - /** * Returns a mutable builder for constructing an instance of * [HrisIndividualRetrieveManyParams]. + * + * The following fields are required: + * ```kotlin + * .requests() + * ``` */ fun builder() = Builder() } @@ -114,21 +120,12 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: - * - [options] * - [requests] + * - [options] */ fun body(body: Body) = apply { this.body = body.toBuilder() } - fun options(options: Options?) = apply { body.options(options) } - - /** - * Sets [Builder.options] to an arbitrary JSON value. - * - * You should usually call [Builder.options] with a well-typed [Options] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun options(options: JsonField) = apply { body.options(options) } - + /** The array of batch requests. Maximum 10000 items per request. */ fun requests(requests: List) = apply { body.requests(requests) } /** @@ -147,6 +144,16 @@ private constructor( */ fun addRequest(request: Request) = apply { body.addRequest(request) } + fun options(options: Options?) = apply { body.options(options) } + + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [Options] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun options(options: JsonField) = apply { body.options(options) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -268,6 +275,13 @@ private constructor( * Returns an immutable instance of [HrisIndividualRetrieveManyParams]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams( @@ -293,37 +307,32 @@ private constructor( class Body @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val options: JsonField, private val requests: JsonField>, + private val options: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("options") @ExcludeMissing options: JsonField = JsonMissing.of(), @JsonProperty("requests") @ExcludeMissing requests: JsonField> = JsonMissing.of(), - ) : this(options, requests, mutableMapOf()) + @JsonProperty("options") @ExcludeMissing options: JsonField = JsonMissing.of(), + ) : this(requests, options, mutableMapOf()) /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * The array of batch requests. Maximum 10000 items per request. + * + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun options(): Options? = options.getNullable("options") + fun requests(): List = requests.getRequired("requests") /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun requests(): List? = requests.getNullable("requests") - - /** - * Returns the raw JSON value of [options]. - * - * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options + fun options(): Options? = options.getNullable("options") /** * Returns the raw JSON value of [requests]. @@ -334,6 +343,13 @@ private constructor( @ExcludeMissing fun _requests(): JsonField> = requests + /** + * Returns the raw JSON value of [options]. + * + * Unlike [options], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("options") @ExcludeMissing fun _options(): JsonField = options + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -348,34 +364,31 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [Body]. */ + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```kotlin + * .requests() + * ``` + */ fun builder() = Builder() } /** A builder for [Body]. */ class Builder internal constructor() { - private var options: JsonField = JsonMissing.of() private var requests: JsonField>? = null + private var options: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(body: Body) = apply { - options = body.options requests = body.requests.map { it.toMutableList() } + options = body.options additionalProperties = body.additionalProperties.toMutableMap() } - fun options(options: Options?) = options(JsonField.ofNullable(options)) - - /** - * Sets [Builder.options] to an arbitrary JSON value. - * - * You should usually call [Builder.options] with a well-typed [Options] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun options(options: JsonField) = apply { this.options = options } - + /** The array of batch requests. Maximum 10000 items per request. */ fun requests(requests: List) = requests(JsonField.of(requests)) /** @@ -401,6 +414,17 @@ private constructor( } } + fun options(options: Options?) = options(JsonField.ofNullable(options)) + + /** + * Sets [Builder.options] to an arbitrary JSON value. + * + * You should usually call [Builder.options] with a well-typed [Options] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun options(options: JsonField) = apply { this.options = options } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -424,11 +448,18 @@ private constructor( * Returns an immutable instance of [Body]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .requests() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): Body = Body( + checkRequired("requests", requests).map { it.toImmutable() }, options, - (requests ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -449,8 +480,8 @@ private constructor( return@apply } + requests().forEach { it.validate() } options()?.validate() - requests()?.forEach { it.validate() } validated = true } @@ -469,8 +500,8 @@ private constructor( * Used for best match union deserialization. */ internal fun validity(): Int = - (options.asKnown()?.validity() ?: 0) + - (requests.asKnown()?.sumOf { it.validity().toInt() } ?: 0) + (requests.asKnown()?.sumOf { it.validity().toInt() } ?: 0) + + (options.asKnown()?.validity() ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -478,45 +509,48 @@ private constructor( } return other is Body && - options == other.options && requests == other.requests && + options == other.options && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(options, requests, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(requests, options, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Body{options=$options, requests=$requests, additionalProperties=$additionalProperties}" + "Body{requests=$requests, options=$options, additionalProperties=$additionalProperties}" } - class Options + class Request @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val include: JsonField>, + private val individualId: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("include") + @JsonProperty("individual_id") @ExcludeMissing - include: JsonField> = JsonMissing.of() - ) : this(include, mutableMapOf()) + individualId: JsonField = JsonMissing.of() + ) : this(individualId, mutableMapOf()) /** - * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws FinchInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun include(): List? = include.getNullable("include") + fun individualId(): String = individualId.getRequired("individual_id") /** - * Returns the raw JSON value of [include]. + * Returns the raw JSON value of [individualId]. * - * Unlike [include], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [individualId], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("include") @ExcludeMissing fun _include(): JsonField> = include + @JsonProperty("individual_id") + @ExcludeMissing + fun _individualId(): JsonField = individualId @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -532,44 +566,39 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [Options]. */ + /** + * Returns a mutable builder for constructing an instance of [Request]. + * + * The following fields are required: + * ```kotlin + * .individualId() + * ``` + */ fun builder() = Builder() } - /** A builder for [Options]. */ + /** A builder for [Request]. */ class Builder internal constructor() { - private var include: JsonField>? = null + private var individualId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(options: Options) = apply { - include = options.include.map { it.toMutableList() } - additionalProperties = options.additionalProperties.toMutableMap() + internal fun from(request: Request) = apply { + individualId = request.individualId + additionalProperties = request.additionalProperties.toMutableMap() } - fun include(include: List) = include(JsonField.of(include)) + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) /** - * Sets [Builder.include] to an arbitrary JSON value. + * Sets [Builder.individualId] to an arbitrary JSON value. * - * You should usually call [Builder.include] with a well-typed `List` value + * You should usually call [Builder.individualId] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun include(include: JsonField>) = apply { - this.include = include.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [Builder.include]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addInclude(include: String) = apply { - this.include = - (this.include ?: JsonField.of(mutableListOf())).also { - checkKnown("include", it).add(include) - } + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId } fun additionalProperties(additionalProperties: Map) = apply { @@ -592,13 +621,20 @@ private constructor( } /** - * Returns an immutable instance of [Options]. + * Returns an immutable instance of [Request]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .individualId() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - fun build(): Options = - Options( - (include ?: JsonMissing.of()).map { it.toImmutable() }, + fun build(): Request = + Request( + checkRequired("individualId", individualId), additionalProperties.toMutableMap(), ) } @@ -614,12 +650,12 @@ private constructor( * @throws FinchInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): Options = apply { + fun validate(): Request = apply { if (validated) { return@apply } - include() + individualId() validated = true } @@ -637,55 +673,52 @@ private constructor( * * Used for best match union deserialization. */ - internal fun validity(): Int = (include.asKnown()?.size ?: 0) + internal fun validity(): Int = (if (individualId.asKnown() == null) 0 else 1) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Options && - include == other.include && + return other is Request && + individualId == other.individualId && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(include, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(individualId, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Options{include=$include, additionalProperties=$additionalProperties}" + "Request{individualId=$individualId, additionalProperties=$additionalProperties}" } - class Request + class Options @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val individualId: JsonField, + private val include: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("individual_id") + @JsonProperty("include") @ExcludeMissing - individualId: JsonField = JsonMissing.of() - ) : this(individualId, mutableMapOf()) + include: JsonField> = JsonMissing.of() + ) : this(include, mutableMapOf()) /** * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun individualId(): String? = individualId.getNullable("individual_id") + fun include(): List? = include.getNullable("include") /** - * Returns the raw JSON value of [individualId]. + * Returns the raw JSON value of [include]. * - * Unlike [individualId], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [include], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("individual_id") - @ExcludeMissing - fun _individualId(): JsonField = individualId + @JsonProperty("include") @ExcludeMissing fun _include(): JsonField> = include @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -701,32 +734,44 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [Request]. */ + /** Returns a mutable builder for constructing an instance of [Options]. */ fun builder() = Builder() } - /** A builder for [Request]. */ + /** A builder for [Options]. */ class Builder internal constructor() { - private var individualId: JsonField = JsonMissing.of() + private var include: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() - internal fun from(request: Request) = apply { - individualId = request.individualId - additionalProperties = request.additionalProperties.toMutableMap() + internal fun from(options: Options) = apply { + include = options.include.map { it.toMutableList() } + additionalProperties = options.additionalProperties.toMutableMap() } - fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + fun include(include: List) = include(JsonField.of(include)) /** - * Sets [Builder.individualId] to an arbitrary JSON value. + * Sets [Builder.include] to an arbitrary JSON value. * - * You should usually call [Builder.individualId] with a well-typed [String] value + * You should usually call [Builder.include] with a well-typed `List` value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun individualId(individualId: JsonField) = apply { - this.individualId = individualId + fun include(include: JsonField>) = apply { + this.include = include.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [Builder.include]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addInclude(include: String) = apply { + this.include = + (this.include ?: JsonField.of(mutableListOf())).also { + checkKnown("include", it).add(include) + } } fun additionalProperties(additionalProperties: Map) = apply { @@ -749,11 +794,15 @@ private constructor( } /** - * Returns an immutable instance of [Request]. + * Returns an immutable instance of [Options]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Request = Request(individualId, additionalProperties.toMutableMap()) + fun build(): Options = + Options( + (include ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -767,12 +816,12 @@ private constructor( * @throws FinchInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): Request = apply { + fun validate(): Options = apply { if (validated) { return@apply } - individualId() + include() validated = true } @@ -790,24 +839,24 @@ private constructor( * * Used for best match union deserialization. */ - internal fun validity(): Int = (if (individualId.asKnown() == null) 0 else 1) + internal fun validity(): Int = (include.asKnown()?.size ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Request && - individualId == other.individualId && + return other is Options && + include == other.include && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(individualId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(include, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Request{individualId=$individualId, additionalProperties=$additionalProperties}" + "Options{include=$include, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt index b0d1ef30d..02a198f3b 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParams.kt @@ -37,7 +37,7 @@ private constructor( fun entityIds(): List? = entityIds /** - * The array of batch requests. + * The array of batch requests. Maximum 10 payment_ids per request. * * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -115,7 +115,7 @@ private constructor( */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** The array of batch requests. */ + /** The array of batch requests. Maximum 10 payment_ids per request. */ fun requests(requests: List) = apply { body.requests(requests) } /** @@ -299,7 +299,7 @@ private constructor( ) : this(requests, mutableMapOf()) /** - * The array of batch requests. + * The array of batch requests. Maximum 10 payment_ids per request. * * @throws FinchInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -351,7 +351,7 @@ private constructor( additionalProperties = body.additionalProperties.toMutableMap() } - /** The array of batch requests. */ + /** The array of batch requests. Maximum 10 payment_ids per request. */ fun requests(requests: List) = requests(JsonField.of(requests)) /** @@ -496,7 +496,7 @@ private constructor( fun paymentId(): String = paymentId.getRequired("payment_id") /** - * Number of pay statements to return (defaults to all). + * Number of pay statements to return (defaults to 100, maximum 5000). * * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -584,7 +584,7 @@ private constructor( */ fun paymentId(paymentId: JsonField) = apply { this.paymentId = paymentId } - /** Number of pay statements to return (defaults to all). */ + /** Number of pay statements to return (defaults to 100, maximum 5000). */ fun limit(limit: Long) = limit(JsonField.of(limit)) /** diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt index 30a5f533b..21e293fe2 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsync.kt @@ -25,14 +25,10 @@ interface IndividualServiceAsync { /** Read individual data, excluding income and employment data */ suspend fun retrieveMany( - params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), + params: HrisIndividualRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisIndividualRetrieveManyPageAsync - /** @see retrieveMany */ - suspend fun retrieveMany(requestOptions: RequestOptions): HrisIndividualRetrieveManyPageAsync = - retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) - /** * A view of [IndividualServiceAsync] that provides access to raw HTTP responses for each * method. @@ -54,15 +50,8 @@ interface IndividualServiceAsync { */ @MustBeClosed suspend fun retrieveMany( - params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), + params: HrisIndividualRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - - /** @see retrieveMany */ - @MustBeClosed - suspend fun retrieveMany( - requestOptions: RequestOptions - ): HttpResponseFor = - retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) } } diff --git a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt index ad97d3a2b..9f42c1c3d 100644 --- a/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt +++ b/finch-kotlin-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualService.kt @@ -25,14 +25,10 @@ interface IndividualService { /** Read individual data, excluding income and employment data */ fun retrieveMany( - params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), + params: HrisIndividualRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HrisIndividualRetrieveManyPage - /** @see retrieveMany */ - fun retrieveMany(requestOptions: RequestOptions): HrisIndividualRetrieveManyPage = - retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) - /** A view of [IndividualService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -51,15 +47,8 @@ interface IndividualService { */ @MustBeClosed fun retrieveMany( - params: HrisIndividualRetrieveManyParams = HrisIndividualRetrieveManyParams.none(), + params: HrisIndividualRetrieveManyParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - - /** @see retrieveMany */ - @MustBeClosed - fun retrieveMany( - requestOptions: RequestOptions - ): HttpResponseFor = - retrieveMany(HrisIndividualRetrieveManyParams.none(), requestOptions) } } diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt index f9501de0a..20e7f976f 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsParamsTest.kt @@ -12,7 +12,7 @@ internal class HrisDirectoryListIndividualsParamsTest { fun create() { HrisDirectoryListIndividualsParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .limit(0L) + .limit(10000L) .offset(0L) .build() } @@ -22,7 +22,7 @@ internal class HrisDirectoryListIndividualsParamsTest { val params = HrisDirectoryListIndividualsParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .limit(0L) + .limit(10000L) .offset(0L) .build() @@ -32,7 +32,7 @@ internal class HrisDirectoryListIndividualsParamsTest { .isEqualTo( QueryParams.builder() .put("entity_ids[]", "550e8400-e29b-41d4-a716-446655440000") - .put("limit", "0") + .put("limit", "10000") .put("offset", "0") .build() ) diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt index f6f231aa2..b7130cd1e 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisDirectoryListParamsTest.kt @@ -12,7 +12,7 @@ internal class HrisDirectoryListParamsTest { fun create() { HrisDirectoryListParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .limit(0L) + .limit(10000L) .offset(0L) .build() } @@ -22,7 +22,7 @@ internal class HrisDirectoryListParamsTest { val params = HrisDirectoryListParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .limit(0L) + .limit(10000L) .offset(0L) .build() @@ -32,7 +32,7 @@ internal class HrisDirectoryListParamsTest { .isEqualTo( QueryParams.builder() .put("entity_ids[]", "550e8400-e29b-41d4-a716-446655440000") - .put("limit", "0") + .put("limit", "10000") .put("offset", "0") .build() ) diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt index 0e3e03298..ce2e9fed5 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyParamsTest.kt @@ -12,14 +12,14 @@ internal class HrisIndividualRetrieveManyParamsTest { fun create() { HrisIndividualRetrieveManyParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .options( - HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() - ) .addRequest( HrisIndividualRetrieveManyParams.Request.builder() .individualId("individual_id") .build() ) + .options( + HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() + ) .build() } @@ -28,14 +28,14 @@ internal class HrisIndividualRetrieveManyParamsTest { val params = HrisIndividualRetrieveManyParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .options( - HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() - ) .addRequest( HrisIndividualRetrieveManyParams.Request.builder() .individualId("individual_id") .build() ) + .options( + HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() + ) .build() val queryParams = params._queryParams() @@ -50,7 +50,14 @@ internal class HrisIndividualRetrieveManyParamsTest { @Test fun queryParamsWithoutOptionalFields() { - val params = HrisIndividualRetrieveManyParams.builder().build() + val params = + HrisIndividualRetrieveManyParams.builder() + .addRequest( + HrisIndividualRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() + ) + .build() val queryParams = params._queryParams() @@ -62,34 +69,48 @@ internal class HrisIndividualRetrieveManyParamsTest { val params = HrisIndividualRetrieveManyParams.builder() .addEntityId("550e8400-e29b-41d4-a716-446655440000") - .options( - HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() - ) .addRequest( HrisIndividualRetrieveManyParams.Request.builder() .individualId("individual_id") .build() ) + .options( + HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() + ) .build() val body = params._body() - assertThat(body.options()) - .isEqualTo( - HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() - ) assertThat(body.requests()) .containsExactly( HrisIndividualRetrieveManyParams.Request.builder() .individualId("individual_id") .build() ) + assertThat(body.options()) + .isEqualTo( + HrisIndividualRetrieveManyParams.Options.builder().addInclude("string").build() + ) } @Test fun bodyWithoutOptionalFields() { - val params = HrisIndividualRetrieveManyParams.builder().build() + val params = + HrisIndividualRetrieveManyParams.builder() + .addRequest( + HrisIndividualRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() + ) + .build() val body = params._body() + + assertThat(body.requests()) + .containsExactly( + HrisIndividualRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() + ) } } diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt index ec29fb0be..bb9a1afc2 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyParamsTest.kt @@ -14,8 +14,8 @@ internal class HrisPayStatementRetrieveManyParamsTest { .addEntityId("550e8400-e29b-41d4-a716-446655440000") .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .limit(50L) + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") + .limit(100L) .offset(0L) .build() ) @@ -29,8 +29,8 @@ internal class HrisPayStatementRetrieveManyParamsTest { .addEntityId("550e8400-e29b-41d4-a716-446655440000") .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .limit(50L) + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") + .limit(100L) .offset(0L) .build() ) @@ -52,7 +52,7 @@ internal class HrisPayStatementRetrieveManyParamsTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") .build() ) .build() @@ -69,8 +69,8 @@ internal class HrisPayStatementRetrieveManyParamsTest { .addEntityId("550e8400-e29b-41d4-a716-446655440000") .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .limit(50L) + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") + .limit(100L) .offset(0L) .build() ) @@ -81,8 +81,8 @@ internal class HrisPayStatementRetrieveManyParamsTest { assertThat(body.requests()) .containsExactly( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .limit(50L) + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") + .limit(100L) .offset(0L) .build() ) @@ -94,7 +94,7 @@ internal class HrisPayStatementRetrieveManyParamsTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") .build() ) .build() @@ -104,7 +104,7 @@ internal class HrisPayStatementRetrieveManyParamsTest { assertThat(body.requests()) .containsExactly( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") .build() ) } diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt index 059dd1d9c..0ec8ab033 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncTest.kt @@ -4,6 +4,7 @@ package com.tryfinch.api.services.async.hris import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClientAsync +import com.tryfinch.api.models.HrisIndividualRetrieveManyParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -19,7 +20,16 @@ internal class IndividualServiceAsyncTest { .build() val individualServiceAsync = client.hris().individuals() - val page = individualServiceAsync.retrieveMany() + val page = + individualServiceAsync.retrieveMany( + HrisIndividualRetrieveManyParams.builder() + .addRequest( + HrisIndividualRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() + ) + .build() + ) page.response().validate() } diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt index 40f3d477d..9b8b1068f 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncTest.kt @@ -25,7 +25,7 @@ internal class PayStatementServiceAsyncTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") .build() ) .build() diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt index 83d763cf0..dd9116341 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceTest.kt @@ -4,6 +4,7 @@ package com.tryfinch.api.services.blocking.hris import com.tryfinch.api.TestServerExtension import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.HrisIndividualRetrieveManyParams import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -19,7 +20,16 @@ internal class IndividualServiceTest { .build() val individualService = client.hris().individuals() - val page = individualService.retrieveMany() + val page = + individualService.retrieveMany( + HrisIndividualRetrieveManyParams.builder() + .addRequest( + HrisIndividualRetrieveManyParams.Request.builder() + .individualId("individual_id") + .build() + ) + .build() + ) page.response().validate() } diff --git a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt index cca8bd084..aa5a0e3dc 100644 --- a/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt +++ b/finch-kotlin-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceTest.kt @@ -25,7 +25,7 @@ internal class PayStatementServiceTest { HrisPayStatementRetrieveManyParams.builder() .addRequest( HrisPayStatementRetrieveManyParams.Request.builder() - .paymentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .paymentId("fc8b024e-d373-4c9c-80fc-f1625383d142") .build() ) .build()