From 8205b91ecd7314e605dc5fb7940928f2b76be4b9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:46:04 +0000 Subject: [PATCH 1/2] feat(api): manual updates (#381) --- .stats.yml | 2 +- .../api/models/DocumentListResponse.kt | 126 ++++ .../tryfinch/api/models/DocumentResponse.kt | 268 +++++++++ .../api/models/DocumentRetreiveResponse.kt | 168 ++++++ .../api/models/HrisDocumentListParams.kt | 315 ++++++++++ .../api/models/HrisDocumentRetreiveParams.kt | 175 ++++++ .../kotlin/com/tryfinch/api/models/W42005.kt | 521 +++++++++++++++++ .../kotlin/com/tryfinch/api/models/W42020.kt | 546 ++++++++++++++++++ .../api/services/async/HrisServiceAsync.kt | 3 + .../services/async/HrisServiceAsyncImpl.kt | 6 + .../async/hris/DocumentServiceAsync.kt | 34 ++ .../async/hris/DocumentServiceAsyncImpl.kt | 90 +++ .../api/services/blocking/HrisService.kt | 3 + .../api/services/blocking/HrisServiceImpl.kt | 6 + .../services/blocking/hris/DocumentService.kt | 33 ++ .../blocking/hris/DocumentServiceImpl.kt | 87 +++ .../api/models/DocumentListResponseTest.kt | 41 ++ .../api/models/DocumentResponseTest.kt | 27 + .../api/models/HrisDocumentListParamsTest.kt | 44 ++ .../models/HrisDocumentRetreiveParamsTest.kt | 24 + .../com/tryfinch/api/models/W42005Test.kt | 40 ++ .../com/tryfinch/api/models/W42020Test.kt | 46 ++ .../blocking/hris/DocumentServiceTest.kt | 50 ++ 23 files changed, 2654 insertions(+), 1 deletion(-) create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt create mode 100644 finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt create mode 100644 finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 05eb3d27..c5beadd4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 38 +configured_endpoints: 40 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-cf610d4dbb7e3d84161b5783a0861b2e551422eb5cf727dde86a839325d7ef76.yml diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt new file mode 100644 index 00000000..20fbf58f --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentListResponse.kt @@ -0,0 +1,126 @@ +// File generated from our OpenAPI spec by Stainless. + +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.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.immutableEmptyMap +import com.tryfinch.api.core.toImmutable +import java.util.Objects + +@NoAutoDetect +class DocumentListResponse +@JsonCreator +private constructor( + @JsonProperty("documents") + @ExcludeMissing + private val documents: JsonField> = JsonMissing.of(), + @JsonProperty("paging") + @ExcludeMissing + private val paging: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), +) { + + fun documents(): List = documents.getRequired("documents") + + fun paging(): Paging = paging.getRequired("paging") + + @JsonProperty("documents") @ExcludeMissing fun _documents() = documents + + @JsonProperty("paging") @ExcludeMissing fun _paging() = paging + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): DocumentListResponse = apply { + if (!validated) { + documents().forEach { it.validate() } + paging().validate() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var documents: JsonField> = JsonMissing.of() + private var paging: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(documentListResponse: DocumentListResponse) = apply { + documents = documentListResponse.documents + paging = documentListResponse.paging + additionalProperties = documentListResponse.additionalProperties.toMutableMap() + } + + fun documents(documents: List) = documents(JsonField.of(documents)) + + fun documents(documents: JsonField>) = apply { + this.documents = documents + } + + fun paging(paging: Paging) = paging(JsonField.of(paging)) + + fun paging(paging: JsonField) = apply { this.paging = paging } + + 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(): DocumentListResponse = + DocumentListResponse( + documents.map { it.toImmutable() }, + paging, + additionalProperties.toImmutable(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DocumentListResponse && documents == other.documents && paging == other.paging && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(documents, paging, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DocumentListResponse{documents=$documents, paging=$paging, additionalProperties=$additionalProperties}" +} 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 new file mode 100644 index 00000000..727052b2 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentResponse.kt @@ -0,0 +1,268 @@ +// File generated from our OpenAPI spec by Stainless. + +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.immutableEmptyMap +import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +@NoAutoDetect +class DocumentResponse +@JsonCreator +private constructor( + @JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonProperty("url") @ExcludeMissing private val url: JsonField = JsonMissing.of(), + @JsonProperty("year") @ExcludeMissing private val year: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), +) { + + /** A stable Finch id for the document. */ + fun id(): Optional = Optional.ofNullable(id.getNullable("id")) + + /** + * The ID of the individual associated with the document. This will be null for employer-level + * documents. + */ + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) + + /** The type of document. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + /** + * A URL to access the document. Format: + * `https://api.tryfinch.com/employer/documents/:document_id`. + */ + fun url(): Optional = Optional.ofNullable(url.getNullable("url")) + + /** The year the document applies to, if available. */ + fun year(): Optional = Optional.ofNullable(year.getNullable("year")) + + /** A stable Finch id for the document. */ + @JsonProperty("id") @ExcludeMissing fun _id() = id + + /** + * The ID of the individual associated with the document. This will be null for employer-level + * documents. + */ + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + + /** The type of document. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** + * A URL to access the document. Format: + * `https://api.tryfinch.com/employer/documents/:document_id`. + */ + @JsonProperty("url") @ExcludeMissing fun _url() = url + + /** The year the document applies to, if available. */ + @JsonProperty("year") @ExcludeMissing fun _year() = year + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): DocumentResponse = apply { + if (!validated) { + id() + individualId() + type() + url() + year() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var id: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var url: JsonField = JsonMissing.of() + private var year: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(documentResponse: DocumentResponse) = apply { + id = documentResponse.id + individualId = documentResponse.individualId + type = documentResponse.type + url = documentResponse.url + year = documentResponse.year + additionalProperties = documentResponse.additionalProperties.toMutableMap() + } + + /** A stable Finch id for the document. */ + fun id(id: String) = id(JsonField.of(id)) + + /** A stable Finch id for the document. */ + fun id(id: JsonField) = apply { this.id = id } + + /** + * The ID of the individual associated with the document. This will be null for + * employer-level documents. + */ + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + + /** + * The ID of the individual associated with the document. This will be null for + * employer-level documents. + */ + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } + + /** The type of document. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** The type of document. */ + fun type(type: JsonField) = apply { this.type = type } + + /** + * A URL to access the document. Format: + * `https://api.tryfinch.com/employer/documents/:document_id`. + */ + fun url(url: String) = url(JsonField.of(url)) + + /** + * A URL to access the document. Format: + * `https://api.tryfinch.com/employer/documents/:document_id`. + */ + fun url(url: JsonField) = apply { this.url = url } + + /** The year the document applies to, if available. */ + fun year(year: Double) = year(JsonField.of(year)) + + /** The year the document applies to, if available. */ + fun year(year: JsonField) = apply { this.year = year } + + 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(): DocumentResponse = + DocumentResponse( + id, + individualId, + type, + url, + year, + additionalProperties.toImmutable(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val W4_2020 = of("w4_2020") + + @JvmField val W4_2005 = of("w4_2005") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + W4_2020, + W4_2005, + } + + enum class Value { + W4_2020, + W4_2005, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + W4_2020 -> Value.W4_2020 + W4_2005 -> Value.W4_2005 + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + W4_2020 -> Known.W4_2020 + W4_2005 -> Known.W4_2005 + 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 DocumentResponse && id == other.id && individualId == other.individualId && type == other.type && url == other.url && year == other.year && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(id, individualId, type, url, year, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DocumentResponse{id=$id, individualId=$individualId, type=$type, url=$url, year=$year, additionalProperties=$additionalProperties}" +} 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 new file mode 100644 index 00000000..f4a7cd62 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/DocumentRetreiveResponse.kt @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.tryfinch.api.core.BaseDeserializer +import com.tryfinch.api.core.BaseSerializer +import com.tryfinch.api.core.JsonValue +import com.tryfinch.api.core.getOrThrow +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * A 2020 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ +@JsonDeserialize(using = DocumentRetreiveResponse.Deserializer::class) +@JsonSerialize(using = DocumentRetreiveResponse.Serializer::class) +class DocumentRetreiveResponse +private constructor( + private val w42020: W42020? = null, + private val w42005: W42005? = null, + private val _json: JsonValue? = null, +) { + + private var validated: Boolean = false + + /** + * A 2020 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ + fun w42020(): Optional = Optional.ofNullable(w42020) + /** + * A 2005 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ + fun w42005(): Optional = Optional.ofNullable(w42005) + + fun isW42020(): Boolean = w42020 != null + + fun isW42005(): Boolean = w42005 != null + + /** + * A 2020 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ + fun asW42020(): W42020 = w42020.getOrThrow("w42020") + /** + * A 2005 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ + fun asW42005(): W42005 = w42005.getOrThrow("w42005") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T { + return when { + w42020 != null -> visitor.visitW42020(w42020) + w42005 != null -> visitor.visitW42005(w42005) + else -> visitor.unknown(_json) + } + } + + fun validate(): DocumentRetreiveResponse = apply { + if (!validated) { + if (w42020 == null && w42005 == null) { + throw FinchInvalidDataException("Unknown DocumentRetreiveResponse: $_json") + } + w42020?.validate() + w42005?.validate() + validated = true + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is DocumentRetreiveResponse && w42020 == other.w42020 && w42005 == other.w42005 /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(w42020, w42005) /* spotless:on */ + + override fun toString(): String = + when { + w42020 != null -> "DocumentRetreiveResponse{w42020=$w42020}" + w42005 != null -> "DocumentRetreiveResponse{w42005=$w42005}" + _json != null -> "DocumentRetreiveResponse{_unknown=$_json}" + else -> throw IllegalStateException("Invalid DocumentRetreiveResponse") + } + + companion object { + + /** + * A 2020 version of the W-4 tax form containing information on an individual's filing + * status, dependents, and withholding details. + */ + @JvmStatic fun ofW42020(w42020: W42020) = DocumentRetreiveResponse(w42020 = w42020) + + /** + * A 2005 version of the W-4 tax form containing information on an individual's filing + * status, dependents, and withholding details. + */ + @JvmStatic fun ofW42005(w42005: W42005) = DocumentRetreiveResponse(w42005 = w42005) + } + + interface Visitor { + + fun visitW42020(w42020: W42020): T + + fun visitW42005(w42005: W42005): T + + fun unknown(json: JsonValue?): T { + throw FinchInvalidDataException("Unknown DocumentRetreiveResponse: $json") + } + } + + class Deserializer : + BaseDeserializer(DocumentRetreiveResponse::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): DocumentRetreiveResponse { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "w4_2020" -> { + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return DocumentRetreiveResponse(w42020 = it, _json = json) + } + } + "w4_2005" -> { + tryDeserialize(node, jacksonTypeRef()) { it.validate() } + ?.let { + return DocumentRetreiveResponse(w42005 = it, _json = json) + } + } + } + + return DocumentRetreiveResponse(_json = json) + } + } + + class Serializer : BaseSerializer(DocumentRetreiveResponse::class) { + + override fun serialize( + value: DocumentRetreiveResponse, + generator: JsonGenerator, + provider: SerializerProvider + ) { + when { + value.w42020 != null -> generator.writeObject(value.w42020) + value.w42005 != null -> generator.writeObject(value.w42005) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid DocumentRetreiveResponse") + } + } + } +} 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 new file mode 100644 index 00000000..8c5fc1f6 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentListParams.kt @@ -0,0 +1,315 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.tryfinch.api.core.Enum +import com.tryfinch.api.core.JsonField +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +class HrisDocumentListParams +constructor( + private val individualIds: List?, + private val limit: Long?, + private val offset: Long?, + private val types: List?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) { + + /** + * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all + * individuals + */ + fun individualIds(): Optional> = Optional.ofNullable(individualIds) + + /** Number of documents to return (defaults to all) */ + fun limit(): Optional = Optional.ofNullable(limit) + + /** Index to start from (defaults to 0) */ + fun offset(): Optional = Optional.ofNullable(offset) + + /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ + fun types(): Optional> = Optional.ofNullable(types) + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + + @JvmSynthetic + internal fun getQueryParams(): QueryParams { + val queryParams = QueryParams.builder() + this.individualIds?.let { queryParams.put("individual_ids[]", it.map(Any::toString)) } + this.limit?.let { queryParams.put("limit", listOf(it.toString())) } + this.offset?.let { queryParams.put("offset", listOf(it.toString())) } + this.types?.let { queryParams.put("types[]", it.map(Any::toString)) } + queryParams.putAll(additionalQueryParams) + return queryParams.build() + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var individualIds: MutableList? = null + private var limit: Long? = null + private var offset: Long? = null + private var types: MutableList? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(hrisDocumentListParams: HrisDocumentListParams) = apply { + individualIds = hrisDocumentListParams.individualIds?.toMutableList() + limit = hrisDocumentListParams.limit + offset = hrisDocumentListParams.offset + types = hrisDocumentListParams.types?.toMutableList() + additionalHeaders = hrisDocumentListParams.additionalHeaders.toBuilder() + additionalQueryParams = hrisDocumentListParams.additionalQueryParams.toBuilder() + } + + /** + * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all + * individuals + */ + fun individualIds(individualIds: List?) = apply { + this.individualIds = individualIds?.toMutableList() + } + + /** + * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all + * individuals + */ + fun individualIds(individualIds: Optional>) = + individualIds(individualIds.orElse(null)) + + /** + * Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all + * individuals + */ + fun addIndividualId(individualId: String) = apply { + individualIds = (individualIds ?: mutableListOf()).apply { add(individualId) } + } + + /** Number of documents to return (defaults to all) */ + fun limit(limit: Long?) = apply { this.limit = limit } + + /** Number of documents to return (defaults to all) */ + fun limit(limit: Long) = limit(limit as Long?) + + /** Number of documents to return (defaults to all) */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long?) = apply { this.offset = offset } + + /** Index to start from (defaults to 0) */ + fun offset(offset: Long) = offset(offset as Long?) + + /** Index to start from (defaults to 0) */ + @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 + fun offset(offset: Optional) = offset(offset.orElse(null) as Long?) + + /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ + fun types(types: List?) = apply { this.types = types?.toMutableList() } + + /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ + fun types(types: Optional>) = types(types.orElse(null)) + + /** Comma-delimited list of document types to filter on. If empty, defaults to all types */ + fun addType(type: Type) = apply { types = (types ?: mutableListOf()).apply { add(type) } } + + 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(): HrisDocumentListParams = + HrisDocumentListParams( + individualIds?.toImmutable(), + limit, + offset, + types?.toImmutable(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val W4_2020 = of("w4_2020") + + @JvmField val W4_2005 = of("w4_2005") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + W4_2020, + W4_2005, + } + + enum class Value { + W4_2020, + W4_2005, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + W4_2020 -> Value.W4_2020 + W4_2005 -> Value.W4_2005 + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + W4_2020 -> Known.W4_2020 + W4_2005 -> Known.W4_2005 + 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 HrisDocumentListParams && individualIds == other.individualIds && limit == other.limit && offset == other.offset && types == other.types && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualIds, limit, offset, types, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "HrisDocumentListParams{individualIds=$individualIds, limit=$limit, offset=$offset, types=$types, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt new file mode 100644 index 00000000..ee938c4c --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParams.kt @@ -0,0 +1,175 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.NoAutoDetect +import com.tryfinch.api.core.http.Headers +import com.tryfinch.api.core.http.QueryParams +import java.util.Objects + +class HrisDocumentRetreiveParams +constructor( + private val documentId: String, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) { + + fun documentId(): String = documentId + + fun _additionalHeaders(): Headers = additionalHeaders + + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + @JvmSynthetic internal fun getHeaders(): Headers = additionalHeaders + + @JvmSynthetic internal fun getQueryParams(): QueryParams = additionalQueryParams + + fun getPathParam(index: Int): String { + return when (index) { + 0 -> documentId + else -> "" + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + @NoAutoDetect + class Builder { + + private var documentId: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(hrisDocumentRetreiveParams: HrisDocumentRetreiveParams) = apply { + documentId = hrisDocumentRetreiveParams.documentId + additionalHeaders = hrisDocumentRetreiveParams.additionalHeaders.toBuilder() + additionalQueryParams = hrisDocumentRetreiveParams.additionalQueryParams.toBuilder() + } + + fun documentId(documentId: String) = apply { this.documentId = documentId } + + 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(): HrisDocumentRetreiveParams = + HrisDocumentRetreiveParams( + checkNotNull(documentId) { "`documentId` is required but was not set" }, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisDocumentRetreiveParams && documentId == other.documentId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(documentId, additionalHeaders, additionalQueryParams) /* spotless:on */ + + override fun toString() = + "HrisDocumentRetreiveParams{documentId=$documentId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} 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 new file mode 100644 index 00000000..fb83cef0 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42005.kt @@ -0,0 +1,521 @@ +// File generated from our OpenAPI spec by Stainless. + +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.immutableEmptyMap +import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +/** + * A 2005 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ +@NoAutoDetect +class W42005 +@JsonCreator +private constructor( + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonProperty("year") @ExcludeMissing private val year: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), +) { + + /** Detailed information specific to the 2005 W4 form. */ + fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + + /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + /** The tax year this W4 document applies to. */ + fun year(): Optional = Optional.ofNullable(year.getNullable("year")) + + /** Detailed information specific to the 2005 W4 form. */ + @JsonProperty("data") @ExcludeMissing fun _data() = data + + /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The tax year this W4 document applies to. */ + @JsonProperty("year") @ExcludeMissing fun _year() = year + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): W42005 = apply { + if (!validated) { + data().map { it.validate() } + type() + year() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var year: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(w42005: W42005) = apply { + data = w42005.data + type = w42005.type + year = w42005.year + additionalProperties = w42005.additionalProperties.toMutableMap() + } + + /** Detailed information specific to the 2005 W4 form. */ + fun data(data: Data) = data(JsonField.of(data)) + + /** Detailed information specific to the 2005 W4 form. */ + fun data(data: JsonField) = apply { this.data = data } + + /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** Specifies the form type, indicating that this document is a 2005 W4 form. */ + fun type(type: JsonField) = apply { this.type = type } + + /** The tax year this W4 document applies to. */ + fun year(year: Double) = year(JsonField.of(year)) + + /** The tax year this W4 document applies to. */ + fun year(year: JsonField) = apply { this.year = year } + + 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(): W42005 = + W42005( + data, + type, + year, + additionalProperties.toImmutable(), + ) + } + + /** Detailed information specific to the 2005 W4 form. */ + @NoAutoDetect + class Data + @JsonCreator + private constructor( + @JsonProperty("additional_withholding") + @ExcludeMissing + private val additionalWithholding: JsonField = JsonMissing.of(), + @JsonProperty("exemption") + @ExcludeMissing + private val exemption: JsonField = JsonMissing.of(), + @JsonProperty("filing_status") + @ExcludeMissing + private val filingStatus: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("total_number_of_allowances") + @ExcludeMissing + private val totalNumberOfAllowances: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** Additional withholding amount (in cents). */ + fun additionalWithholding(): Optional = + Optional.ofNullable(additionalWithholding.getNullable("additional_withholding")) + + /** Indicates exemption status from federal tax withholding. */ + fun exemption(): Optional = + Optional.ofNullable(exemption.getNullable("exemption")) + + /** The individual's filing status for tax purposes. */ + fun filingStatus(): Optional = + Optional.ofNullable(filingStatus.getNullable("filing_status")) + + /** The unique identifier for the individual associated with this 2005 W4 form. */ + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) + + /** Total number of allowances claimed (in cents). */ + fun totalNumberOfAllowances(): Optional = + Optional.ofNullable(totalNumberOfAllowances.getNullable("total_number_of_allowances")) + + /** Additional withholding amount (in cents). */ + @JsonProperty("additional_withholding") + @ExcludeMissing + fun _additionalWithholding() = additionalWithholding + + /** Indicates exemption status from federal tax withholding. */ + @JsonProperty("exemption") @ExcludeMissing fun _exemption() = exemption + + /** The individual's filing status for tax purposes. */ + @JsonProperty("filing_status") @ExcludeMissing fun _filingStatus() = filingStatus + + /** The unique identifier for the individual associated with this 2005 W4 form. */ + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + + /** Total number of allowances claimed (in cents). */ + @JsonProperty("total_number_of_allowances") + @ExcludeMissing + fun _totalNumberOfAllowances() = totalNumberOfAllowances + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (!validated) { + additionalWithholding() + exemption() + filingStatus() + individualId() + totalNumberOfAllowances() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var additionalWithholding: JsonField = JsonMissing.of() + private var exemption: JsonField = JsonMissing.of() + private var filingStatus: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() + private var totalNumberOfAllowances: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(data: Data) = apply { + additionalWithholding = data.additionalWithholding + exemption = data.exemption + filingStatus = data.filingStatus + individualId = data.individualId + totalNumberOfAllowances = data.totalNumberOfAllowances + additionalProperties = data.additionalProperties.toMutableMap() + } + + /** Additional withholding amount (in cents). */ + fun additionalWithholding(additionalWithholding: Long) = + additionalWithholding(JsonField.of(additionalWithholding)) + + /** Additional withholding amount (in cents). */ + fun additionalWithholding(additionalWithholding: JsonField) = apply { + this.additionalWithholding = additionalWithholding + } + + /** Indicates exemption status from federal tax withholding. */ + fun exemption(exemption: Exemption) = exemption(JsonField.of(exemption)) + + /** Indicates exemption status from federal tax withholding. */ + fun exemption(exemption: JsonField) = apply { this.exemption = exemption } + + /** The individual's filing status for tax purposes. */ + fun filingStatus(filingStatus: FilingStatus) = filingStatus(JsonField.of(filingStatus)) + + /** The individual's filing status for tax purposes. */ + fun filingStatus(filingStatus: JsonField) = apply { + this.filingStatus = filingStatus + } + + /** The unique identifier for the individual associated with this 2005 W4 form. */ + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + + /** The unique identifier for the individual associated with this 2005 W4 form. */ + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } + + /** Total number of allowances claimed (in cents). */ + fun totalNumberOfAllowances(totalNumberOfAllowances: Long) = + totalNumberOfAllowances(JsonField.of(totalNumberOfAllowances)) + + /** Total number of allowances claimed (in cents). */ + fun totalNumberOfAllowances(totalNumberOfAllowances: JsonField) = apply { + this.totalNumberOfAllowances = totalNumberOfAllowances + } + + 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(): Data = + Data( + additionalWithholding, + exemption, + filingStatus, + individualId, + totalNumberOfAllowances, + additionalProperties.toImmutable(), + ) + } + + class Exemption + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EXEMPT = of("exempt") + + @JvmField val NON_EXEMPT = of("non_exempt") + + @JvmStatic fun of(value: String) = Exemption(JsonField.of(value)) + } + + enum class Known { + EXEMPT, + NON_EXEMPT, + } + + enum class Value { + EXEMPT, + NON_EXEMPT, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + EXEMPT -> Value.EXEMPT + NON_EXEMPT -> Value.NON_EXEMPT + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + EXEMPT -> Known.EXEMPT + NON_EXEMPT -> Known.NON_EXEMPT + else -> throw FinchInvalidDataException("Unknown Exemption: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Exemption && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class FilingStatus + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val MARRIED = of("married") + + @JvmField + val MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE = + of("married_but_withhold_at_higher_single_rate") + + @JvmField val SINGLE = of("single") + + @JvmStatic fun of(value: String) = FilingStatus(JsonField.of(value)) + } + + enum class Known { + MARRIED, + MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE, + SINGLE, + } + + enum class Value { + MARRIED, + MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE, + SINGLE, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + MARRIED -> Value.MARRIED + MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE -> + Value.MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE + SINGLE -> Value.SINGLE + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + MARRIED -> Known.MARRIED + MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE -> + Known.MARRIED_BUT_WITHHOLD_AT_HIGHER_SINGLE_RATE + SINGLE -> Known.SINGLE + else -> throw FinchInvalidDataException("Unknown FilingStatus: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FilingStatus && 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 Data && additionalWithholding == other.additionalWithholding && exemption == other.exemption && filingStatus == other.filingStatus && individualId == other.individualId && totalNumberOfAllowances == other.totalNumberOfAllowances && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(additionalWithholding, exemption, filingStatus, individualId, totalNumberOfAllowances, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Data{additionalWithholding=$additionalWithholding, exemption=$exemption, filingStatus=$filingStatus, individualId=$individualId, totalNumberOfAllowances=$totalNumberOfAllowances, additionalProperties=$additionalProperties}" + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val W4_2005 = of("w4_2005") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + W4_2005, + } + + enum class Value { + W4_2005, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + W4_2005 -> Value.W4_2005 + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + W4_2005 -> Known.W4_2005 + 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 W42005 && data == other.data && type == other.type && year == other.year && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(data, type, year, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "W42005{data=$data, type=$type, year=$year, additionalProperties=$additionalProperties}" +} 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 new file mode 100644 index 00000000..499da6a8 --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/W42020.kt @@ -0,0 +1,546 @@ +// File generated from our OpenAPI spec by Stainless. + +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.immutableEmptyMap +import com.tryfinch.api.core.toImmutable +import com.tryfinch.api.errors.FinchInvalidDataException +import java.util.Objects +import java.util.Optional + +/** + * A 2020 version of the W-4 tax form containing information on an individual's filing status, + * dependents, and withholding details. + */ +@NoAutoDetect +class W42020 +@JsonCreator +private constructor( + @JsonProperty("data") @ExcludeMissing private val data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(), + @JsonProperty("year") @ExcludeMissing private val year: JsonField = JsonMissing.of(), + @JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(), +) { + + /** Detailed information specific to the 2020 W4 form. */ + fun data(): Optional = Optional.ofNullable(data.getNullable("data")) + + /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + fun type(): Optional = Optional.ofNullable(type.getNullable("type")) + + /** The tax year this W4 document applies to. */ + fun year(): Optional = Optional.ofNullable(year.getNullable("year")) + + /** Detailed information specific to the 2020 W4 form. */ + @JsonProperty("data") @ExcludeMissing fun _data() = data + + /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + @JsonProperty("type") @ExcludeMissing fun _type() = type + + /** The tax year this W4 document applies to. */ + @JsonProperty("year") @ExcludeMissing fun _year() = year + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): W42020 = apply { + if (!validated) { + data().map { it.validate() } + type() + year() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var data: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var year: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(w42020: W42020) = apply { + data = w42020.data + type = w42020.type + year = w42020.year + additionalProperties = w42020.additionalProperties.toMutableMap() + } + + /** Detailed information specific to the 2020 W4 form. */ + fun data(data: Data) = data(JsonField.of(data)) + + /** Detailed information specific to the 2020 W4 form. */ + fun data(data: JsonField) = apply { this.data = data } + + /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + fun type(type: Type) = type(JsonField.of(type)) + + /** Specifies the form type, indicating that this document is a 2020 W4 form. */ + fun type(type: JsonField) = apply { this.type = type } + + /** The tax year this W4 document applies to. */ + fun year(year: Double) = year(JsonField.of(year)) + + /** The tax year this W4 document applies to. */ + fun year(year: JsonField) = apply { this.year = year } + + 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(): W42020 = + W42020( + data, + type, + year, + additionalProperties.toImmutable(), + ) + } + + /** Detailed information specific to the 2020 W4 form. */ + @NoAutoDetect + class Data + @JsonCreator + private constructor( + @JsonProperty("amount_for_other_dependents") + @ExcludeMissing + private val amountForOtherDependents: JsonField = JsonMissing.of(), + @JsonProperty("amount_for_qualifying_children_under_17") + @ExcludeMissing + private val amountForQualifyingChildrenUnder17: JsonField = JsonMissing.of(), + @JsonProperty("deductions") + @ExcludeMissing + private val deductions: JsonField = JsonMissing.of(), + @JsonProperty("extra_withholding") + @ExcludeMissing + private val extraWithholding: JsonField = JsonMissing.of(), + @JsonProperty("filing_status") + @ExcludeMissing + private val filingStatus: JsonField = JsonMissing.of(), + @JsonProperty("individual_id") + @ExcludeMissing + private val individualId: JsonField = JsonMissing.of(), + @JsonProperty("other_income") + @ExcludeMissing + private val otherIncome: JsonField = JsonMissing.of(), + @JsonProperty("total_claim_dependent_and_other_credits") + @ExcludeMissing + private val totalClaimDependentAndOtherCredits: JsonField = JsonMissing.of(), + @JsonAnySetter + private val additionalProperties: Map = immutableEmptyMap(), + ) { + + /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + fun amountForOtherDependents(): Optional = + Optional.ofNullable(amountForOtherDependents.getNullable("amount_for_other_dependents")) + + /** Amount claimed for dependents under 17 years old (in cents). */ + fun amountForQualifyingChildrenUnder17(): Optional = + Optional.ofNullable( + amountForQualifyingChildrenUnder17.getNullable( + "amount_for_qualifying_children_under_17" + ) + ) + + /** Deductible expenses (in cents). */ + fun deductions(): Optional = Optional.ofNullable(deductions.getNullable("deductions")) + + /** Additional withholding amount (in cents). */ + fun extraWithholding(): Optional = + Optional.ofNullable(extraWithholding.getNullable("extra_withholding")) + + /** The individual's filing status for tax purposes. */ + fun filingStatus(): Optional = + Optional.ofNullable(filingStatus.getNullable("filing_status")) + + /** The unique identifier for the individual associated with this document. */ + fun individualId(): Optional = + Optional.ofNullable(individualId.getNullable("individual_id")) + + /** Additional income from sources outside of primary employment (in cents). */ + fun otherIncome(): Optional = + Optional.ofNullable(otherIncome.getNullable("other_income")) + + /** Total amount claimed for dependents and other credits (in cents). */ + fun totalClaimDependentAndOtherCredits(): Optional = + Optional.ofNullable( + totalClaimDependentAndOtherCredits.getNullable( + "total_claim_dependent_and_other_credits" + ) + ) + + /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + @JsonProperty("amount_for_other_dependents") + @ExcludeMissing + fun _amountForOtherDependents() = amountForOtherDependents + + /** Amount claimed for dependents under 17 years old (in cents). */ + @JsonProperty("amount_for_qualifying_children_under_17") + @ExcludeMissing + fun _amountForQualifyingChildrenUnder17() = amountForQualifyingChildrenUnder17 + + /** Deductible expenses (in cents). */ + @JsonProperty("deductions") @ExcludeMissing fun _deductions() = deductions + + /** Additional withholding amount (in cents). */ + @JsonProperty("extra_withholding") + @ExcludeMissing + fun _extraWithholding() = extraWithholding + + /** The individual's filing status for tax purposes. */ + @JsonProperty("filing_status") @ExcludeMissing fun _filingStatus() = filingStatus + + /** The unique identifier for the individual associated with this document. */ + @JsonProperty("individual_id") @ExcludeMissing fun _individualId() = individualId + + /** Additional income from sources outside of primary employment (in cents). */ + @JsonProperty("other_income") @ExcludeMissing fun _otherIncome() = otherIncome + + /** Total amount claimed for dependents and other credits (in cents). */ + @JsonProperty("total_claim_dependent_and_other_credits") + @ExcludeMissing + fun _totalClaimDependentAndOtherCredits() = totalClaimDependentAndOtherCredits + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (!validated) { + amountForOtherDependents() + amountForQualifyingChildrenUnder17() + deductions() + extraWithholding() + filingStatus() + individualId() + otherIncome() + totalClaimDependentAndOtherCredits() + validated = true + } + } + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun builder() = Builder() + } + + class Builder { + + private var amountForOtherDependents: JsonField = JsonMissing.of() + private var amountForQualifyingChildrenUnder17: JsonField = JsonMissing.of() + private var deductions: JsonField = JsonMissing.of() + private var extraWithholding: JsonField = JsonMissing.of() + private var filingStatus: JsonField = JsonMissing.of() + private var individualId: JsonField = JsonMissing.of() + private var otherIncome: JsonField = JsonMissing.of() + private var totalClaimDependentAndOtherCredits: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(data: Data) = apply { + amountForOtherDependents = data.amountForOtherDependents + amountForQualifyingChildrenUnder17 = data.amountForQualifyingChildrenUnder17 + deductions = data.deductions + extraWithholding = data.extraWithholding + filingStatus = data.filingStatus + individualId = data.individualId + otherIncome = data.otherIncome + totalClaimDependentAndOtherCredits = data.totalClaimDependentAndOtherCredits + additionalProperties = data.additionalProperties.toMutableMap() + } + + /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + fun amountForOtherDependents(amountForOtherDependents: Long) = + amountForOtherDependents(JsonField.of(amountForOtherDependents)) + + /** Amount claimed for dependents other than qualifying children under 17 (in cents). */ + fun amountForOtherDependents(amountForOtherDependents: JsonField) = apply { + this.amountForOtherDependents = amountForOtherDependents + } + + /** Amount claimed for dependents under 17 years old (in cents). */ + fun amountForQualifyingChildrenUnder17(amountForQualifyingChildrenUnder17: Long) = + amountForQualifyingChildrenUnder17(JsonField.of(amountForQualifyingChildrenUnder17)) + + /** Amount claimed for dependents under 17 years old (in cents). */ + fun amountForQualifyingChildrenUnder17( + amountForQualifyingChildrenUnder17: JsonField + ) = apply { + this.amountForQualifyingChildrenUnder17 = amountForQualifyingChildrenUnder17 + } + + /** Deductible expenses (in cents). */ + fun deductions(deductions: Long) = deductions(JsonField.of(deductions)) + + /** Deductible expenses (in cents). */ + fun deductions(deductions: JsonField) = apply { this.deductions = deductions } + + /** Additional withholding amount (in cents). */ + fun extraWithholding(extraWithholding: Long) = + extraWithholding(JsonField.of(extraWithholding)) + + /** Additional withholding amount (in cents). */ + fun extraWithholding(extraWithholding: JsonField) = apply { + this.extraWithholding = extraWithholding + } + + /** The individual's filing status for tax purposes. */ + fun filingStatus(filingStatus: FilingStatus) = filingStatus(JsonField.of(filingStatus)) + + /** The individual's filing status for tax purposes. */ + fun filingStatus(filingStatus: JsonField) = apply { + this.filingStatus = filingStatus + } + + /** The unique identifier for the individual associated with this document. */ + fun individualId(individualId: String) = individualId(JsonField.of(individualId)) + + /** The unique identifier for the individual associated with this document. */ + fun individualId(individualId: JsonField) = apply { + this.individualId = individualId + } + + /** Additional income from sources outside of primary employment (in cents). */ + fun otherIncome(otherIncome: Long) = otherIncome(JsonField.of(otherIncome)) + + /** Additional income from sources outside of primary employment (in cents). */ + fun otherIncome(otherIncome: JsonField) = apply { this.otherIncome = otherIncome } + + /** Total amount claimed for dependents and other credits (in cents). */ + fun totalClaimDependentAndOtherCredits(totalClaimDependentAndOtherCredits: Long) = + totalClaimDependentAndOtherCredits(JsonField.of(totalClaimDependentAndOtherCredits)) + + /** Total amount claimed for dependents and other credits (in cents). */ + fun totalClaimDependentAndOtherCredits( + totalClaimDependentAndOtherCredits: JsonField + ) = apply { + this.totalClaimDependentAndOtherCredits = totalClaimDependentAndOtherCredits + } + + 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(): Data = + Data( + amountForOtherDependents, + amountForQualifyingChildrenUnder17, + deductions, + extraWithholding, + filingStatus, + individualId, + otherIncome, + totalClaimDependentAndOtherCredits, + additionalProperties.toImmutable(), + ) + } + + class FilingStatus + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val HEAD_OF_HOUSEHOLD = of("head_of_household") + + @JvmField + val MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE = + of("married_filing_jointly_or_qualifying_surviving_spouse") + + @JvmField + val SINGLE_OR_MARRIED_FILING_SEPARATELY = of("single_or_married_filing_separately") + + @JvmStatic fun of(value: String) = FilingStatus(JsonField.of(value)) + } + + enum class Known { + HEAD_OF_HOUSEHOLD, + MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE, + SINGLE_OR_MARRIED_FILING_SEPARATELY, + } + + enum class Value { + HEAD_OF_HOUSEHOLD, + MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE, + SINGLE_OR_MARRIED_FILING_SEPARATELY, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + HEAD_OF_HOUSEHOLD -> Value.HEAD_OF_HOUSEHOLD + MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE -> + Value.MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE + SINGLE_OR_MARRIED_FILING_SEPARATELY -> Value.SINGLE_OR_MARRIED_FILING_SEPARATELY + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + HEAD_OF_HOUSEHOLD -> Known.HEAD_OF_HOUSEHOLD + MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE -> + Known.MARRIED_FILING_JOINTLY_OR_QUALIFYING_SURVIVING_SPOUSE + SINGLE_OR_MARRIED_FILING_SEPARATELY -> Known.SINGLE_OR_MARRIED_FILING_SEPARATELY + else -> throw FinchInvalidDataException("Unknown FilingStatus: $value") + } + + fun asString(): String = _value().asStringOrThrow() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is FilingStatus && 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 Data && amountForOtherDependents == other.amountForOtherDependents && amountForQualifyingChildrenUnder17 == other.amountForQualifyingChildrenUnder17 && deductions == other.deductions && extraWithholding == other.extraWithholding && filingStatus == other.filingStatus && individualId == other.individualId && otherIncome == other.otherIncome && totalClaimDependentAndOtherCredits == other.totalClaimDependentAndOtherCredits && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(amountForOtherDependents, amountForQualifyingChildrenUnder17, deductions, extraWithholding, filingStatus, individualId, otherIncome, totalClaimDependentAndOtherCredits, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Data{amountForOtherDependents=$amountForOtherDependents, amountForQualifyingChildrenUnder17=$amountForQualifyingChildrenUnder17, deductions=$deductions, extraWithholding=$extraWithholding, filingStatus=$filingStatus, individualId=$individualId, otherIncome=$otherIncome, totalClaimDependentAndOtherCredits=$totalClaimDependentAndOtherCredits, additionalProperties=$additionalProperties}" + } + + class Type + @JsonCreator + private constructor( + private val value: JsonField, + ) : Enum { + + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val W4_2020 = of("w4_2020") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + enum class Known { + W4_2020, + } + + enum class Value { + W4_2020, + _UNKNOWN, + } + + fun value(): Value = + when (this) { + W4_2020 -> Value.W4_2020 + else -> Value._UNKNOWN + } + + fun known(): Known = + when (this) { + W4_2020 -> Known.W4_2020 + 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 W42020 && data == other.data && type == other.type && year == other.year && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(data, type, year, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "W42020{data=$data, type=$type, year=$year, additionalProperties=$additionalProperties}" +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt index 4be88910..1e10b682 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/HrisServiceAsync.kt @@ -5,6 +5,7 @@ package com.tryfinch.api.services.async import com.tryfinch.api.services.async.hris.BenefitServiceAsync import com.tryfinch.api.services.async.hris.CompanyServiceAsync import com.tryfinch.api.services.async.hris.DirectoryServiceAsync +import com.tryfinch.api.services.async.hris.DocumentServiceAsync import com.tryfinch.api.services.async.hris.EmploymentServiceAsync import com.tryfinch.api.services.async.hris.IndividualServiceAsync import com.tryfinch.api.services.async.hris.PayStatementServiceAsync @@ -24,5 +25,7 @@ interface HrisServiceAsync { fun payStatements(): PayStatementServiceAsync + fun documents(): DocumentServiceAsync + fun benefits(): BenefitServiceAsync } 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 9135c253..ad82c240 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 @@ -9,6 +9,8 @@ import com.tryfinch.api.services.async.hris.CompanyServiceAsync import com.tryfinch.api.services.async.hris.CompanyServiceAsyncImpl import com.tryfinch.api.services.async.hris.DirectoryServiceAsync import com.tryfinch.api.services.async.hris.DirectoryServiceAsyncImpl +import com.tryfinch.api.services.async.hris.DocumentServiceAsync +import com.tryfinch.api.services.async.hris.DocumentServiceAsyncImpl import com.tryfinch.api.services.async.hris.EmploymentServiceAsync import com.tryfinch.api.services.async.hris.EmploymentServiceAsyncImpl import com.tryfinch.api.services.async.hris.IndividualServiceAsync @@ -43,6 +45,8 @@ constructor( PayStatementServiceAsyncImpl(clientOptions) } + private val documents: DocumentServiceAsync by lazy { DocumentServiceAsyncImpl(clientOptions) } + private val benefits: BenefitServiceAsync by lazy { BenefitServiceAsyncImpl(clientOptions) } override fun company(): CompanyServiceAsync = company @@ -57,5 +61,7 @@ constructor( override fun payStatements(): PayStatementServiceAsync = payStatements + override fun documents(): DocumentServiceAsync = documents + override fun benefits(): BenefitServiceAsync = benefits } 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 new file mode 100644 index 00000000..182bca7f --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsync.kt @@ -0,0 +1,34 @@ +// File generated from our OpenAPI spec by Stainless. + +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.DocumentListResponse +import com.tryfinch.api.models.DocumentRetreiveResponse +import com.tryfinch.api.models.HrisDocumentListParams +import com.tryfinch.api.models.HrisDocumentRetreiveParams +import java.util.concurrent.CompletableFuture + +interface DocumentServiceAsync { + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. + */ + @JvmOverloads + fun list( + params: HrisDocumentListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): CompletableFuture + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by + * its ID. + */ + @JvmOverloads + fun retreive( + params: HrisDocumentRetreiveParams, + 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 new file mode 100644 index 00000000..6220340d --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DocumentServiceAsyncImpl.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.async.hris + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.handlers.errorHandler +import com.tryfinch.api.core.handlers.jsonHandler +import com.tryfinch.api.core.handlers.withErrorHandler +import com.tryfinch.api.core.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.models.DocumentListResponse +import com.tryfinch.api.models.DocumentRetreiveResponse +import com.tryfinch.api.models.HrisDocumentListParams +import com.tryfinch.api.models.HrisDocumentRetreiveParams +import java.util.concurrent.CompletableFuture + +class DocumentServiceAsyncImpl +constructor( + private val clientOptions: ClientOptions, +) : DocumentServiceAsync { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. + */ + override fun list( + params: HrisDocumentListParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents") + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .replaceAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val retreiveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by + * its ID. + */ + override fun retreive( + params: HrisDocumentRetreiveParams, + requestOptions: RequestOptions + ): CompletableFuture { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents", params.getPathParam(0)) + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .replaceAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response + -> + response + .use { retreiveHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt index 294a564c..5e993449 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/HrisService.kt @@ -5,6 +5,7 @@ package com.tryfinch.api.services.blocking import com.tryfinch.api.services.blocking.hris.BenefitService import com.tryfinch.api.services.blocking.hris.CompanyService import com.tryfinch.api.services.blocking.hris.DirectoryService +import com.tryfinch.api.services.blocking.hris.DocumentService import com.tryfinch.api.services.blocking.hris.EmploymentService import com.tryfinch.api.services.blocking.hris.IndividualService import com.tryfinch.api.services.blocking.hris.PayStatementService @@ -24,5 +25,7 @@ interface HrisService { fun payStatements(): PayStatementService + fun documents(): DocumentService + fun benefits(): BenefitService } 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 7acb9057..16a39aa7 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 @@ -9,6 +9,8 @@ import com.tryfinch.api.services.blocking.hris.CompanyService import com.tryfinch.api.services.blocking.hris.CompanyServiceImpl import com.tryfinch.api.services.blocking.hris.DirectoryService import com.tryfinch.api.services.blocking.hris.DirectoryServiceImpl +import com.tryfinch.api.services.blocking.hris.DocumentService +import com.tryfinch.api.services.blocking.hris.DocumentServiceImpl import com.tryfinch.api.services.blocking.hris.EmploymentService import com.tryfinch.api.services.blocking.hris.EmploymentServiceImpl import com.tryfinch.api.services.blocking.hris.IndividualService @@ -37,6 +39,8 @@ constructor( PayStatementServiceImpl(clientOptions) } + private val documents: DocumentService by lazy { DocumentServiceImpl(clientOptions) } + private val benefits: BenefitService by lazy { BenefitServiceImpl(clientOptions) } override fun company(): CompanyService = company @@ -51,5 +55,7 @@ constructor( override fun payStatements(): PayStatementService = payStatements + override fun documents(): DocumentService = documents + override fun benefits(): BenefitService = benefits } 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 new file mode 100644 index 00000000..fc30aa9a --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentService.kt @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. + +@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102 + +package com.tryfinch.api.services.blocking.hris + +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.models.DocumentListResponse +import com.tryfinch.api.models.DocumentRetreiveResponse +import com.tryfinch.api.models.HrisDocumentListParams +import com.tryfinch.api.models.HrisDocumentRetreiveParams + +interface DocumentService { + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. + */ + @JvmOverloads + fun list( + params: HrisDocumentListParams, + requestOptions: RequestOptions = RequestOptions.none() + ): DocumentListResponse + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by + * its ID. + */ + @JvmOverloads + fun retreive( + params: HrisDocumentRetreiveParams, + 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 new file mode 100644 index 00000000..6a3f4cad --- /dev/null +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceImpl.kt @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris + +import com.tryfinch.api.core.ClientOptions +import com.tryfinch.api.core.RequestOptions +import com.tryfinch.api.core.handlers.errorHandler +import com.tryfinch.api.core.handlers.jsonHandler +import com.tryfinch.api.core.handlers.withErrorHandler +import com.tryfinch.api.core.http.HttpMethod +import com.tryfinch.api.core.http.HttpRequest +import com.tryfinch.api.core.http.HttpResponse.Handler +import com.tryfinch.api.errors.FinchError +import com.tryfinch.api.models.DocumentListResponse +import com.tryfinch.api.models.DocumentRetreiveResponse +import com.tryfinch.api.models.HrisDocumentListParams +import com.tryfinch.api.models.HrisDocumentRetreiveParams + +class DocumentServiceImpl +constructor( + private val clientOptions: ClientOptions, +) : DocumentService { + + private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve a list of company-wide documents. + */ + override fun list( + params: HrisDocumentListParams, + requestOptions: RequestOptions + ): DocumentListResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents") + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .replaceAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { listHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } + + private val retreiveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + .withErrorHandler(errorHandler) + + /** + * **Beta:** This endpoint is in beta and may change. Retrieve details of a specific document by + * its ID. + */ + override fun retreive( + params: HrisDocumentRetreiveParams, + requestOptions: RequestOptions + ): DocumentRetreiveResponse { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("employer", "documents", params.getPathParam(0)) + .putAllQueryParams(clientOptions.queryParams) + .replaceAllQueryParams(params.getQueryParams()) + .putAllHeaders(clientOptions.headers) + .replaceAllHeaders(params.getHeaders()) + .build() + return clientOptions.httpClient.execute(request, requestOptions).let { response -> + response + .use { retreiveHandler.handle(it) } + .apply { + if (requestOptions.responseValidation ?: clientOptions.responseValidation) { + validate() + } + } + } + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt new file mode 100644 index 00000000..2804ce70 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentListResponseTest.kt @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class DocumentListResponseTest { + + @Test + fun createDocumentListResponse() { + val documentListResponse = + DocumentListResponse.builder() + .documents( + listOf( + DocumentResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .individualId("individual_id") + .type(DocumentResponse.Type.W4_2020) + .url("https://example.com") + .year(0.0) + .build() + ) + ) + .paging(Paging.builder().count(0L).offset(0L).build()) + .build() + assertThat(documentListResponse).isNotNull + assertThat(documentListResponse.documents()) + .containsExactly( + DocumentResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .individualId("individual_id") + .type(DocumentResponse.Type.W4_2020) + .url("https://example.com") + .year(0.0) + .build() + ) + assertThat(documentListResponse.paging()) + .isEqualTo(Paging.builder().count(0L).offset(0L).build()) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt new file mode 100644 index 00000000..d138c11d --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/DocumentResponseTest.kt @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class DocumentResponseTest { + + @Test + fun createDocumentResponse() { + val documentResponse = + DocumentResponse.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .individualId("individual_id") + .type(DocumentResponse.Type.W4_2020) + .url("https://example.com") + .year(0.0) + .build() + assertThat(documentResponse).isNotNull + assertThat(documentResponse.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(documentResponse.individualId()).contains("individual_id") + assertThat(documentResponse.type()).contains(DocumentResponse.Type.W4_2020) + assertThat(documentResponse.url()).contains("https://example.com") + assertThat(documentResponse.year()).contains(0.0) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt new file mode 100644 index 00000000..5c413161 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentListParamsTest.kt @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import com.tryfinch.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class HrisDocumentListParamsTest { + + @Test + fun createHrisDocumentListParams() { + HrisDocumentListParams.builder() + .individualIds(listOf("string")) + .limit(0L) + .offset(0L) + .types(listOf(HrisDocumentListParams.Type.W4_2020)) + .build() + } + + @Test + fun getQueryParams() { + val params = + HrisDocumentListParams.builder() + .individualIds(listOf("string")) + .limit(0L) + .offset(0L) + .types(listOf(HrisDocumentListParams.Type.W4_2020)) + .build() + val expected = QueryParams.builder() + expected.put("individual_ids[]", "string") + expected.put("limit", "0") + expected.put("offset", "0") + expected.put("types[]", HrisDocumentListParams.Type.W4_2020.toString()) + assertThat(params.getQueryParams()).isEqualTo(expected.build()) + } + + @Test + fun getQueryParamsWithoutOptionalFields() { + val params = HrisDocumentListParams.builder().build() + val expected = QueryParams.builder() + assertThat(params.getQueryParams()).isEqualTo(expected.build()) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt new file mode 100644 index 00000000..a521478d --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisDocumentRetreiveParamsTest.kt @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class HrisDocumentRetreiveParamsTest { + + @Test + fun createHrisDocumentRetreiveParams() { + HrisDocumentRetreiveParams.builder().documentId("document_id").build() + } + + @Test + fun getPathParam() { + val params = HrisDocumentRetreiveParams.builder().documentId("document_id").build() + assertThat(params).isNotNull + // path param "documentId" + assertThat(params.getPathParam(0)).isEqualTo("document_id") + // out-of-bound path param + assertThat(params.getPathParam(1)).isEqualTo("") + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt new file mode 100644 index 00000000..4a7f6313 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42005Test.kt @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class W42005Test { + + @Test + fun createW42005() { + val w42005 = + W42005.builder() + .data( + W42005.Data.builder() + .additionalWithholding(0L) + .exemption(W42005.Data.Exemption.EXEMPT) + .filingStatus(W42005.Data.FilingStatus.MARRIED) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .totalNumberOfAllowances(0L) + .build() + ) + .type(W42005.Type.W4_2005) + .year(0.0) + .build() + assertThat(w42005).isNotNull + assertThat(w42005.data()) + .contains( + W42005.Data.builder() + .additionalWithholding(0L) + .exemption(W42005.Data.Exemption.EXEMPT) + .filingStatus(W42005.Data.FilingStatus.MARRIED) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .totalNumberOfAllowances(0L) + .build() + ) + assertThat(w42005.type()).contains(W42005.Type.W4_2005) + assertThat(w42005.year()).contains(0.0) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt new file mode 100644 index 00000000..227e9d74 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/models/W42020Test.kt @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class W42020Test { + + @Test + fun createW42020() { + val w42020 = + W42020.builder() + .data( + W42020.Data.builder() + .amountForOtherDependents(0L) + .amountForQualifyingChildrenUnder17(0L) + .deductions(0L) + .extraWithholding(0L) + .filingStatus(W42020.Data.FilingStatus.HEAD_OF_HOUSEHOLD) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .otherIncome(0L) + .totalClaimDependentAndOtherCredits(0L) + .build() + ) + .type(W42020.Type.W4_2020) + .year(0.0) + .build() + assertThat(w42020).isNotNull + assertThat(w42020.data()) + .contains( + W42020.Data.builder() + .amountForOtherDependents(0L) + .amountForQualifyingChildrenUnder17(0L) + .deductions(0L) + .extraWithholding(0L) + .filingStatus(W42020.Data.FilingStatus.HEAD_OF_HOUSEHOLD) + .individualId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .otherIncome(0L) + .totalClaimDependentAndOtherCredits(0L) + .build() + ) + assertThat(w42020.type()).contains(W42020.Type.W4_2020) + assertThat(w42020.year()).contains(0.0) + } +} diff --git a/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt new file mode 100644 index 00000000..aa7fdf33 --- /dev/null +++ b/finch-java-core/src/test/kotlin/com/tryfinch/api/services/blocking/hris/DocumentServiceTest.kt @@ -0,0 +1,50 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.tryfinch.api.services.blocking.hris + +import com.tryfinch.api.TestServerExtension +import com.tryfinch.api.client.okhttp.FinchOkHttpClient +import com.tryfinch.api.models.HrisDocumentListParams +import com.tryfinch.api.models.HrisDocumentRetreiveParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +class DocumentServiceTest { + + @Test + fun callList() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val documentService = client.hris().documents() + val documentListResponse = + documentService.list( + HrisDocumentListParams.builder() + .individualIds(listOf("string")) + .limit(0L) + .offset(0L) + .types(listOf(HrisDocumentListParams.Type.W4_2020)) + .build() + ) + println(documentListResponse) + documentListResponse.validate() + } + + @Test + fun callRetreive() { + val client = + FinchOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .accessToken("My Access Token") + .build() + val documentService = client.hris().documents() + val documentRetreiveResponse = + documentService.retreive( + HrisDocumentRetreiveParams.builder().documentId("document_id").build() + ) + println(documentRetreiveResponse) + } +} From 651dcb811b19a1dec10510d220ffdc3349af183d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:46:31 +0000 Subject: [PATCH 2/2] release: 3.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 6 +++--- build.gradle.kts | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4191c889..e0dc5001 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0" + ".": "3.1.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index efcf5ac0..11cfb2f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.1.0 (2025-01-07) + +Full Changelog: [v3.0.0...v3.1.0](https://github.com/Finch-API/finch-api-java/compare/v3.0.0...v3.1.0) + +### Features + +* **api:** manual updates ([#381](https://github.com/Finch-API/finch-api-java/issues/381)) ([8205b91](https://github.com/Finch-API/finch-api-java/commit/8205b91ecd7314e605dc5fb7940928f2b76be4b9)) + ## 3.0.0 (2025-01-06) Full Changelog: [v2.0.0...v3.0.0](https://github.com/Finch-API/finch-api-java/compare/v2.0.0...v3.0.0) diff --git a/README.md b/README.md index dcd740fe..8a51daf7 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/3.0.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/3.1.0) @@ -27,7 +27,7 @@ The REST API documentation can be foundĀ [in the Finch Documentation Center](htt ```kotlin -implementation("com.tryfinch.api:finch-java:3.0.0") +implementation("com.tryfinch.api:finch-java:3.1.0") ``` #### Maven @@ -36,7 +36,7 @@ implementation("com.tryfinch.api:finch-java:3.0.0") com.tryfinch.api finch-java - 3.0.0 + 3.1.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 29cf7048..427d86ce 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "com.tryfinch.api" - version = "3.0.0" // x-release-please-version + version = "3.1.0" // x-release-please-version }