From b8f20ee928ac5694896236f22156f85f4b723326 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 02:30:04 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 8 +- .../entities/EntityValidationParams.kt | 1035 +++++++++++++++++ .../services/async/SimulationServiceAsync.kt | 5 + .../async/SimulationServiceAsyncImpl.kt | 12 + .../async/simulations/EntityServiceAsync.kt | 94 ++ .../simulations/EntityServiceAsyncImpl.kt | 91 ++ .../services/blocking/SimulationService.kt | 5 + .../blocking/SimulationServiceImpl.kt | 12 + .../blocking/simulations/EntityService.kt | 90 ++ .../blocking/simulations/EntityServiceImpl.kt | 87 ++ .../entities/EntityValidationParamsTest.kt | 64 + .../simulations/EntityServiceAsyncTest.kt | 39 + .../blocking/simulations/EntityServiceTest.kt | 38 + 13 files changed, 1576 insertions(+), 4 deletions(-) create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/simulations/entities/EntityValidationParams.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsync.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncImpl.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityService.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityServiceImpl.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/simulations/entities/EntityValidationParamsTest.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncTest.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/EntityServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 074cbe61a..7c1929726 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 237 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase/increase-bd2f5c49181098955f0dbdee1511e28d4a8b9d2a16433f747defd59430bb961f.yml -openapi_spec_hash: 206afcc5ec5f6294d1f185ee808d675c -config_hash: b4f1725275c973bb61f07d1bdc2b71d5 +configured_endpoints: 238 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase/increase-f0841004cde131703a9fc63fec3ae9ce98b63f0e8fe8d4326d1d75142538eda3.yml +openapi_spec_hash: a5a1e052b6e09ba465311f8adfcf9429 +config_hash: 060e036e1db198f2e908364c9df7096e diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/entities/EntityValidationParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/entities/EntityValidationParams.kt new file mode 100644 index 000000000..91330e8c0 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/entities/EntityValidationParams.kt @@ -0,0 +1,1035 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.simulations.entities + +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.increase.api.core.Enum +import com.increase.api.core.ExcludeMissing +import com.increase.api.core.JsonField +import com.increase.api.core.JsonMissing +import com.increase.api.core.JsonValue +import com.increase.api.core.Params +import com.increase.api.core.checkKnown +import com.increase.api.core.checkRequired +import com.increase.api.core.http.Headers +import com.increase.api.core.http.QueryParams +import com.increase.api.core.toImmutable +import com.increase.api.errors.IncreaseInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Simulates setting an [Entity](#entities)'s validation under the managed compliance regime. Any + * existing managed compliance validation on the Entity will be marked as no longer current. + */ +class EntityValidationParams +private constructor( + private val entityId: String?, + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** The identifier of the Entity to set the validation on. */ + fun entityId(): Optional = Optional.ofNullable(entityId) + + /** + * The issues to attach to the new managed compliance validation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun issues(): List = body.issues() + + /** + * The status to set on the new managed compliance validation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = body.status() + + /** + * Returns the raw JSON value of [issues]. + * + * Unlike [issues], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _issues(): JsonField> = body._issues() + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _status(): JsonField = body._status() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [EntityValidationParams]. + * + * The following fields are required: + * ```java + * .issues() + * .status() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [EntityValidationParams]. */ + class Builder internal constructor() { + + private var entityId: String? = null + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(entityValidationParams: EntityValidationParams) = apply { + entityId = entityValidationParams.entityId + body = entityValidationParams.body.toBuilder() + additionalHeaders = entityValidationParams.additionalHeaders.toBuilder() + additionalQueryParams = entityValidationParams.additionalQueryParams.toBuilder() + } + + /** The identifier of the Entity to set the validation on. */ + fun entityId(entityId: String?) = apply { this.entityId = entityId } + + /** Alias for calling [Builder.entityId] with `entityId.orElse(null)`. */ + fun entityId(entityId: Optional) = entityId(entityId.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [issues] + * - [status] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The issues to attach to the new managed compliance validation. */ + fun issues(issues: List) = apply { body.issues(issues) } + + /** + * Sets [Builder.issues] to an arbitrary JSON value. + * + * You should usually call [Builder.issues] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun issues(issues: JsonField>) = apply { body.issues(issues) } + + /** + * Adds a single [Issue] to [issues]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIssue(issue: Issue) = apply { body.addIssue(issue) } + + /** The status to set on the new managed compliance validation. */ + fun status(status: Status) = apply { body.status(status) } + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { body.status(status) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun 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) + } + + /** + * Returns an immutable instance of [EntityValidationParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .issues() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): EntityValidationParams = + EntityValidationParams( + entityId, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> entityId ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val issues: JsonField>, + private val status: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("issues") + @ExcludeMissing + issues: JsonField> = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + ) : this(issues, status, mutableMapOf()) + + /** + * The issues to attach to the new managed compliance validation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun issues(): List = issues.getRequired("issues") + + /** + * The status to set on the new managed compliance validation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun status(): Status = status.getRequired("status") + + /** + * Returns the raw JSON value of [issues]. + * + * Unlike [issues], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("issues") @ExcludeMissing fun _issues(): JsonField> = issues + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .issues() + * .status() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var issues: JsonField>? = null + private var status: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + issues = body.issues.map { it.toMutableList() } + status = body.status + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The issues to attach to the new managed compliance validation. */ + fun issues(issues: List) = issues(JsonField.of(issues)) + + /** + * Sets [Builder.issues] to an arbitrary JSON value. + * + * You should usually call [Builder.issues] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun issues(issues: JsonField>) = apply { + this.issues = issues.map { it.toMutableList() } + } + + /** + * Adds a single [Issue] to [issues]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIssue(issue: Issue) = apply { + issues = + (issues ?: JsonField.of(mutableListOf())).also { + checkKnown("issues", it).add(issue) + } + } + + /** The status to set on the new managed compliance validation. */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + 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) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .issues() + * .status() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("issues", issues).map { it.toImmutable() }, + checkRequired("status", status), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + issues().forEach { it.validate() } + status().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (issues.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + issues == other.issues && + status == other.status && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(issues, status, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{issues=$issues, status=$status, additionalProperties=$additionalProperties}" + } + + class Issue + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val category: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("category") + @ExcludeMissing + category: JsonField = JsonMissing.of() + ) : this(category, mutableMapOf()) + + /** + * The category of the issue. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun category(): Category = category.getRequired("category") + + /** + * Returns the raw JSON value of [category]. + * + * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Issue]. + * + * The following fields are required: + * ```java + * .category() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Issue]. */ + class Builder internal constructor() { + + private var category: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(issue: Issue) = apply { + category = issue.category + additionalProperties = issue.additionalProperties.toMutableMap() + } + + /** The category of the issue. */ + fun category(category: Category) = category(JsonField.of(category)) + + /** + * Sets [Builder.category] to an arbitrary JSON value. + * + * You should usually call [Builder.category] with a well-typed [Category] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun category(category: JsonField) = apply { this.category = category } + + 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) + } + + /** + * Returns an immutable instance of [Issue]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .category() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Issue = + Issue(checkRequired("category", category), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Issue = apply { + if (validated) { + return@apply + } + + category().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (category.asKnown().getOrNull()?.validity() ?: 0) + + /** The category of the issue. */ + class Category @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** + * The entity's tax identifier could not be validated. Update the tax ID with the + * [update an entity API](/documentation/api/entities#update-an-entity.corporation.legal_identifier). + */ + @JvmField val ENTITY_TAX_IDENTIFIER = of("entity_tax_identifier") + + /** + * The entity's address could not be validated. Update the address with the + * [update an entity API](/documentation/api/entities#update-an-entity.corporation.address). + */ + @JvmField val ENTITY_ADDRESS = of("entity_address") + + /** + * A beneficial owner's identity could not be verified. Update the identification + * with the + * [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + */ + @JvmField val BENEFICIAL_OWNER_IDENTITY = of("beneficial_owner_identity") + + /** + * A beneficial owner's address could not be validated. Update the address with the + * [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + */ + @JvmField val BENEFICIAL_OWNER_ADDRESS = of("beneficial_owner_address") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + /** + * The entity's tax identifier could not be validated. Update the tax ID with the + * [update an entity API](/documentation/api/entities#update-an-entity.corporation.legal_identifier). + */ + ENTITY_TAX_IDENTIFIER, + /** + * The entity's address could not be validated. Update the address with the + * [update an entity API](/documentation/api/entities#update-an-entity.corporation.address). + */ + ENTITY_ADDRESS, + /** + * A beneficial owner's identity could not be verified. Update the identification + * with the + * [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + */ + BENEFICIAL_OWNER_IDENTITY, + /** + * A beneficial owner's address could not be validated. Update the address with the + * [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + */ + BENEFICIAL_OWNER_ADDRESS, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * The entity's tax identifier could not be validated. Update the tax ID with the + * [update an entity API](/documentation/api/entities#update-an-entity.corporation.legal_identifier). + */ + ENTITY_TAX_IDENTIFIER, + /** + * The entity's address could not be validated. Update the address with the + * [update an entity API](/documentation/api/entities#update-an-entity.corporation.address). + */ + ENTITY_ADDRESS, + /** + * A beneficial owner's identity could not be verified. Update the identification + * with the + * [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + */ + BENEFICIAL_OWNER_IDENTITY, + /** + * A beneficial owner's address could not be validated. Update the address with the + * [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + */ + BENEFICIAL_OWNER_ADDRESS, + /** + * An enum member indicating that [Category] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ENTITY_TAX_IDENTIFIER -> Value.ENTITY_TAX_IDENTIFIER + ENTITY_ADDRESS -> Value.ENTITY_ADDRESS + BENEFICIAL_OWNER_IDENTITY -> Value.BENEFICIAL_OWNER_IDENTITY + BENEFICIAL_OWNER_ADDRESS -> Value.BENEFICIAL_OWNER_ADDRESS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ENTITY_TAX_IDENTIFIER -> Known.ENTITY_TAX_IDENTIFIER + ENTITY_ADDRESS -> Known.ENTITY_ADDRESS + BENEFICIAL_OWNER_IDENTITY -> Known.BENEFICIAL_OWNER_IDENTITY + BENEFICIAL_OWNER_ADDRESS -> Known.BENEFICIAL_OWNER_ADDRESS + else -> throw IncreaseInvalidDataException("Unknown Category: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Issue && + category == other.category && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(category, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Issue{category=$category, additionalProperties=$additionalProperties}" + } + + /** The status to set on the new managed compliance validation. */ + class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** The submitted data is valid. */ + @JvmField val VALID = of("valid") + + /** Additional information is required to validate the data. */ + @JvmField val INVALID = of("invalid") + + /** The submitted data is being validated. */ + @JvmField val PENDING = of("pending") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + /** The submitted data is valid. */ + VALID, + /** Additional information is required to validate the data. */ + INVALID, + /** The submitted data is being validated. */ + PENDING, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The submitted data is valid. */ + VALID, + /** Additional information is required to validate the data. */ + INVALID, + /** The submitted data is being validated. */ + PENDING, + /** An enum member indicating that [Status] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + VALID -> Value.VALID + INVALID -> Value.INVALID + PENDING -> Value.PENDING + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + VALID -> Known.VALID + INVALID -> Known.INVALID + PENDING -> Known.PENDING + else -> throw IncreaseInvalidDataException("Unknown Status: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Status = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EntityValidationParams && + entityId == other.entityId && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(entityId, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "EntityValidationParams{entityId=$entityId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt index b6fee2199..8d5b7124e 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt @@ -22,6 +22,7 @@ import com.increase.api.services.async.simulations.CheckDepositServiceAsync import com.increase.api.services.async.simulations.CheckTransferServiceAsync import com.increase.api.services.async.simulations.DigitalWalletTokenRequestServiceAsync import com.increase.api.services.async.simulations.EntityOnboardingSessionServiceAsync +import com.increase.api.services.async.simulations.EntityServiceAsync import com.increase.api.services.async.simulations.ExportServiceAsync import com.increase.api.services.async.simulations.InboundAchTransferServiceAsync import com.increase.api.services.async.simulations.InboundCheckDepositServiceAsync @@ -111,6 +112,8 @@ interface SimulationServiceAsync { fun inboundMailItems(): InboundMailItemServiceAsync + fun entities(): EntityServiceAsync + fun entityOnboardingSessions(): EntityOnboardingSessionServiceAsync fun programs(): ProgramServiceAsync @@ -195,6 +198,8 @@ interface SimulationServiceAsync { fun inboundMailItems(): InboundMailItemServiceAsync.WithRawResponse + fun entities(): EntityServiceAsync.WithRawResponse + fun entityOnboardingSessions(): EntityOnboardingSessionServiceAsync.WithRawResponse fun programs(): ProgramServiceAsync.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt index d91db6188..1fb7e0227 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt @@ -41,6 +41,8 @@ import com.increase.api.services.async.simulations.DigitalWalletTokenRequestServ import com.increase.api.services.async.simulations.DigitalWalletTokenRequestServiceAsyncImpl import com.increase.api.services.async.simulations.EntityOnboardingSessionServiceAsync import com.increase.api.services.async.simulations.EntityOnboardingSessionServiceAsyncImpl +import com.increase.api.services.async.simulations.EntityServiceAsync +import com.increase.api.services.async.simulations.EntityServiceAsyncImpl import com.increase.api.services.async.simulations.ExportServiceAsync import com.increase.api.services.async.simulations.ExportServiceAsyncImpl import com.increase.api.services.async.simulations.InboundAchTransferServiceAsync @@ -197,6 +199,8 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: InboundMailItemServiceAsyncImpl(clientOptions) } + private val entities: EntityServiceAsync by lazy { EntityServiceAsyncImpl(clientOptions) } + private val entityOnboardingSessions: EntityOnboardingSessionServiceAsync by lazy { EntityOnboardingSessionServiceAsyncImpl(clientOptions) } @@ -284,6 +288,8 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun inboundMailItems(): InboundMailItemServiceAsync = inboundMailItems + override fun entities(): EntityServiceAsync = entities + override fun entityOnboardingSessions(): EntityOnboardingSessionServiceAsync = entityOnboardingSessions @@ -423,6 +429,10 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: InboundMailItemServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val entities: EntityServiceAsync.WithRawResponse by lazy { + EntityServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val entityOnboardingSessions: EntityOnboardingSessionServiceAsync.WithRawResponse by lazy { EntityOnboardingSessionServiceAsyncImpl.WithRawResponseImpl(clientOptions) @@ -529,6 +539,8 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun inboundMailItems(): InboundMailItemServiceAsync.WithRawResponse = inboundMailItems + override fun entities(): EntityServiceAsync.WithRawResponse = entities + override fun entityOnboardingSessions(): EntityOnboardingSessionServiceAsync.WithRawResponse = entityOnboardingSessions diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsync.kt new file mode 100644 index 000000000..26145d20c --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsync.kt @@ -0,0 +1,94 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.async.simulations + +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.models.entities.Entity +import com.increase.api.models.simulations.entities.EntityValidationParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface EntityServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): EntityServiceAsync + + /** + * Simulates setting an [Entity](#entities)'s validation under the managed compliance regime. + * Any existing managed compliance validation on the Entity will be marked as no longer current. + */ + fun validation(entityId: String, params: EntityValidationParams): CompletableFuture = + validation(entityId, params, RequestOptions.none()) + + /** @see validation */ + fun validation( + entityId: String, + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + validation(params.toBuilder().entityId(entityId).build(), requestOptions) + + /** @see validation */ + fun validation(params: EntityValidationParams): CompletableFuture = + validation(params, RequestOptions.none()) + + /** @see validation */ + fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [EntityServiceAsync] that provides access to raw HTTP responses for each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): EntityServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /simulations/entities/{entity_id}/validation`, but + * is otherwise the same as [EntityServiceAsync.validation]. + */ + fun validation( + entityId: String, + params: EntityValidationParams, + ): CompletableFuture> = + validation(entityId, params, RequestOptions.none()) + + /** @see validation */ + fun validation( + entityId: String, + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + validation(params.toBuilder().entityId(entityId).build(), requestOptions) + + /** @see validation */ + fun validation(params: EntityValidationParams): CompletableFuture> = + validation(params, RequestOptions.none()) + + /** @see validation */ + fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncImpl.kt new file mode 100644 index 000000000..149ea3bf1 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncImpl.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.async.simulations + +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.checkRequired +import com.increase.api.core.handlers.errorBodyHandler +import com.increase.api.core.handlers.errorHandler +import com.increase.api.core.handlers.jsonHandler +import com.increase.api.core.http.HttpMethod +import com.increase.api.core.http.HttpRequest +import com.increase.api.core.http.HttpResponse +import com.increase.api.core.http.HttpResponse.Handler +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.core.http.json +import com.increase.api.core.http.parseable +import com.increase.api.core.prepareAsync +import com.increase.api.models.entities.Entity +import com.increase.api.models.simulations.entities.EntityValidationParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class EntityServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + EntityServiceAsync { + + private val withRawResponse: EntityServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): EntityServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): EntityServiceAsync = + EntityServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /simulations/entities/{entity_id}/validation + withRawResponse().validation(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + EntityServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): EntityServiceAsync.WithRawResponse = + EntityServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val validationHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("entityId", params.entityId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("simulations", "entities", params._pathParam(0), "validation") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { validationHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt index 49aa6aa3b..ba646a2c3 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt @@ -22,6 +22,7 @@ import com.increase.api.services.blocking.simulations.CheckDepositService import com.increase.api.services.blocking.simulations.CheckTransferService import com.increase.api.services.blocking.simulations.DigitalWalletTokenRequestService import com.increase.api.services.blocking.simulations.EntityOnboardingSessionService +import com.increase.api.services.blocking.simulations.EntityService import com.increase.api.services.blocking.simulations.ExportService import com.increase.api.services.blocking.simulations.InboundAchTransferService import com.increase.api.services.blocking.simulations.InboundCheckDepositService @@ -111,6 +112,8 @@ interface SimulationService { fun inboundMailItems(): InboundMailItemService + fun entities(): EntityService + fun entityOnboardingSessions(): EntityOnboardingSessionService fun programs(): ProgramService @@ -192,6 +195,8 @@ interface SimulationService { fun inboundMailItems(): InboundMailItemService.WithRawResponse + fun entities(): EntityService.WithRawResponse + fun entityOnboardingSessions(): EntityOnboardingSessionService.WithRawResponse fun programs(): ProgramService.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt index 17b6f4502..e262241f3 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt @@ -41,6 +41,8 @@ import com.increase.api.services.blocking.simulations.DigitalWalletTokenRequestS import com.increase.api.services.blocking.simulations.DigitalWalletTokenRequestServiceImpl import com.increase.api.services.blocking.simulations.EntityOnboardingSessionService import com.increase.api.services.blocking.simulations.EntityOnboardingSessionServiceImpl +import com.increase.api.services.blocking.simulations.EntityService +import com.increase.api.services.blocking.simulations.EntityServiceImpl import com.increase.api.services.blocking.simulations.ExportService import com.increase.api.services.blocking.simulations.ExportServiceImpl import com.increase.api.services.blocking.simulations.InboundAchTransferService @@ -190,6 +192,8 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie InboundMailItemServiceImpl(clientOptions) } + private val entities: EntityService by lazy { EntityServiceImpl(clientOptions) } + private val entityOnboardingSessions: EntityOnboardingSessionService by lazy { EntityOnboardingSessionServiceImpl(clientOptions) } @@ -272,6 +276,8 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun inboundMailItems(): InboundMailItemService = inboundMailItems + override fun entities(): EntityService = entities + override fun entityOnboardingSessions(): EntityOnboardingSessionService = entityOnboardingSessions @@ -407,6 +413,10 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie InboundMailItemServiceImpl.WithRawResponseImpl(clientOptions) } + private val entities: EntityService.WithRawResponse by lazy { + EntityServiceImpl.WithRawResponseImpl(clientOptions) + } + private val entityOnboardingSessions: EntityOnboardingSessionService.WithRawResponse by lazy { EntityOnboardingSessionServiceImpl.WithRawResponseImpl(clientOptions) @@ -511,6 +521,8 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun inboundMailItems(): InboundMailItemService.WithRawResponse = inboundMailItems + override fun entities(): EntityService.WithRawResponse = entities + override fun entityOnboardingSessions(): EntityOnboardingSessionService.WithRawResponse = entityOnboardingSessions diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityService.kt new file mode 100644 index 000000000..ee55f3532 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityService.kt @@ -0,0 +1,90 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.blocking.simulations + +import com.google.errorprone.annotations.MustBeClosed +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.models.entities.Entity +import com.increase.api.models.simulations.entities.EntityValidationParams +import java.util.function.Consumer + +interface EntityService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): EntityService + + /** + * Simulates setting an [Entity](#entities)'s validation under the managed compliance regime. + * Any existing managed compliance validation on the Entity will be marked as no longer current. + */ + fun validation(entityId: String, params: EntityValidationParams): Entity = + validation(entityId, params, RequestOptions.none()) + + /** @see validation */ + fun validation( + entityId: String, + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Entity = validation(params.toBuilder().entityId(entityId).build(), requestOptions) + + /** @see validation */ + fun validation(params: EntityValidationParams): Entity = + validation(params, RequestOptions.none()) + + /** @see validation */ + fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Entity + + /** A view of [EntityService] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): EntityService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /simulations/entities/{entity_id}/validation`, but + * is otherwise the same as [EntityService.validation]. + */ + @MustBeClosed + fun validation(entityId: String, params: EntityValidationParams): HttpResponseFor = + validation(entityId, params, RequestOptions.none()) + + /** @see validation */ + @MustBeClosed + fun validation( + entityId: String, + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + validation(params.toBuilder().entityId(entityId).build(), requestOptions) + + /** @see validation */ + @MustBeClosed + fun validation(params: EntityValidationParams): HttpResponseFor = + validation(params, RequestOptions.none()) + + /** @see validation */ + @MustBeClosed + fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityServiceImpl.kt new file mode 100644 index 000000000..c22448266 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/EntityServiceImpl.kt @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.blocking.simulations + +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.checkRequired +import com.increase.api.core.handlers.errorBodyHandler +import com.increase.api.core.handlers.errorHandler +import com.increase.api.core.handlers.jsonHandler +import com.increase.api.core.http.HttpMethod +import com.increase.api.core.http.HttpRequest +import com.increase.api.core.http.HttpResponse +import com.increase.api.core.http.HttpResponse.Handler +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.core.http.json +import com.increase.api.core.http.parseable +import com.increase.api.core.prepare +import com.increase.api.models.entities.Entity +import com.increase.api.models.simulations.entities.EntityValidationParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class EntityServiceImpl internal constructor(private val clientOptions: ClientOptions) : + EntityService { + + private val withRawResponse: EntityService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): EntityService.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): EntityService = + EntityServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions, + ): Entity = + // post /simulations/entities/{entity_id}/validation + withRawResponse().validation(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + EntityService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): EntityService.WithRawResponse = + EntityServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val validationHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun validation( + params: EntityValidationParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("entityId", params.entityId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("simulations", "entities", params._pathParam(0), "validation") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { validationHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/entities/EntityValidationParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/entities/EntityValidationParamsTest.kt new file mode 100644 index 000000000..ca6e44bd4 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/entities/EntityValidationParamsTest.kt @@ -0,0 +1,64 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.simulations.entities + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class EntityValidationParamsTest { + + @Test + fun create() { + EntityValidationParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .addIssue( + EntityValidationParams.Issue.builder() + .category(EntityValidationParams.Issue.Category.ENTITY_TAX_IDENTIFIER) + .build() + ) + .status(EntityValidationParams.Status.INVALID) + .build() + } + + @Test + fun pathParams() { + val params = + EntityValidationParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .addIssue( + EntityValidationParams.Issue.builder() + .category(EntityValidationParams.Issue.Category.ENTITY_TAX_IDENTIFIER) + .build() + ) + .status(EntityValidationParams.Status.INVALID) + .build() + + assertThat(params._pathParam(0)).isEqualTo("entity_n8y8tnk2p9339ti393yi") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + EntityValidationParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .addIssue( + EntityValidationParams.Issue.builder() + .category(EntityValidationParams.Issue.Category.ENTITY_TAX_IDENTIFIER) + .build() + ) + .status(EntityValidationParams.Status.INVALID) + .build() + + val body = params._body() + + assertThat(body.issues()) + .containsExactly( + EntityValidationParams.Issue.builder() + .category(EntityValidationParams.Issue.Category.ENTITY_TAX_IDENTIFIER) + .build() + ) + assertThat(body.status()).isEqualTo(EntityValidationParams.Status.INVALID) + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncTest.kt new file mode 100644 index 000000000..8f2fa0a76 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/EntityServiceAsyncTest.kt @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.async.simulations + +import com.increase.api.TestServerExtension +import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync +import com.increase.api.models.simulations.entities.EntityValidationParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class EntityServiceAsyncTest { + + @Test + fun validation() { + val client = + IncreaseOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val entityServiceAsync = client.simulations().entities() + + val entityFuture = + entityServiceAsync.validation( + EntityValidationParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .addIssue( + EntityValidationParams.Issue.builder() + .category(EntityValidationParams.Issue.Category.ENTITY_TAX_IDENTIFIER) + .build() + ) + .status(EntityValidationParams.Status.INVALID) + .build() + ) + + val entity = entityFuture.get() + entity.validate() + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/EntityServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/EntityServiceTest.kt new file mode 100644 index 000000000..07e0b67c6 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/EntityServiceTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.blocking.simulations + +import com.increase.api.TestServerExtension +import com.increase.api.client.okhttp.IncreaseOkHttpClient +import com.increase.api.models.simulations.entities.EntityValidationParams +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class EntityServiceTest { + + @Test + fun validation() { + val client = + IncreaseOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val entityService = client.simulations().entities() + + val entity = + entityService.validation( + EntityValidationParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .addIssue( + EntityValidationParams.Issue.builder() + .category(EntityValidationParams.Issue.Category.ENTITY_TAX_IDENTIFIER) + .build() + ) + .status(EntityValidationParams.Status.INVALID) + .build() + ) + + entity.validate() + } +} From 0111079bb7ac13f674ec82c92ba028d8ab848a5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 02:44:40 +0000 Subject: [PATCH 2/2] release: 0.533.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dac2a9006..fbfcf3739 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.532.0" + ".": "0.533.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ff9f63e..4fcd91407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.533.0 (2026-05-01) + +Full Changelog: [v0.532.0...v0.533.0](https://github.com/Increase/increase-java/compare/v0.532.0...v0.533.0) + +### Features + +* **api:** api update ([b8f20ee](https://github.com/Increase/increase-java/commit/b8f20ee928ac5694896236f22156f85f4b723326)) + ## 0.532.0 (2026-04-30) Full Changelog: [v0.531.0...v0.532.0](https://github.com/Increase/increase-java/compare/v0.531.0...v0.532.0) diff --git a/README.md b/README.md index db4c7a1fe..e8277c43a 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.532.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.532.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.532.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.533.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.533.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.533.0) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.532.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.533.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.532.0") +implementation("com.increase.api:increase-java:0.533.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.532.0") com.increase.api increase-java - 0.532.0 + 0.533.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 78ce82b12..ad1e00c33 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.532.0" // x-release-please-version + version = "0.533.0" // x-release-please-version } subprojects {