diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d1b100d62..da7827268 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.313.0" + ".": "0.314.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 7002ed35c..602fdb7cc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 217 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-166f5a60acb9f1b94415e641215f0988dc14a8bce6a0e1a95e521fdbb0b91243.yml -openapi_spec_hash: adbd71ae90ad4559759517a17c4fec08 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-6d1cfc3f93b6829318d0905c04d24008ab3576d5c00d8eb17c7d55fc34beef9e.yml +openapi_spec_hash: 12f331a1ebc9c7c8465a850736a8d8c6 config_hash: 2a4a1945e6eefa24fa5b0590cf580fb4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 56034046b..68c329f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.314.0 (2025-09-05) + +Full Changelog: [v0.313.0...v0.314.0](https://github.com/Increase/increase-java/compare/v0.313.0...v0.314.0) + +### Features + +* **api:** api update ([e73ca86](https://github.com/Increase/increase-java/commit/e73ca86c001d332306539c8c158ebd84c35013bb)) + ## 0.313.0 (2025-09-04) Full Changelog: [v0.312.0...v0.313.0](https://github.com/Increase/increase-java/compare/v0.312.0...v0.313.0) diff --git a/README.md b/README.md index 1cfbd7633..5da4a3c23 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.313.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.313.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.313.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.314.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.314.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.314.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.313.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.314.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.313.0") +implementation("com.increase.api:increase-java:0.314.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.313.0") com.increase.api increase-java - 0.313.0 + 0.314.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index ff0dfab1f..4a233a4f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.313.0" // x-release-please-version + version = "0.314.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateParams.kt index 7de1270c9..afbd05ffc 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityUpdateParams.kt @@ -34,6 +34,30 @@ private constructor( /** The entity identifier. */ fun entityId(): Optional = Optional.ofNullable(entityId) + /** + * Details of the corporation entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun corporation(): Optional = body.corporation() + + /** + * Details of the government authority entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun governmentAuthority(): Optional = body.governmentAuthority() + + /** + * Details of the natural person entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun naturalPerson(): Optional = body.naturalPerson() + /** * An assessment of the entity’s potential risk of involvement in financial crimes, such as * money laundering. @@ -52,6 +76,36 @@ private constructor( */ fun thirdPartyVerification(): Optional = body.thirdPartyVerification() + /** + * Details of the trust entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun trust(): Optional = body.trust() + + /** + * Returns the raw JSON value of [corporation]. + * + * Unlike [corporation], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _corporation(): JsonField = body._corporation() + + /** + * Returns the raw JSON value of [governmentAuthority]. + * + * Unlike [governmentAuthority], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _governmentAuthority(): JsonField = body._governmentAuthority() + + /** + * Returns the raw JSON value of [naturalPerson]. + * + * Unlike [naturalPerson], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _naturalPerson(): JsonField = body._naturalPerson() + /** * Returns the raw JSON value of [riskRating]. * @@ -68,6 +122,13 @@ private constructor( fun _thirdPartyVerification(): JsonField = body._thirdPartyVerification() + /** + * Returns the raw JSON value of [trust]. + * + * Unlike [trust], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _trust(): JsonField = body._trust() + fun _additionalBodyProperties(): Map = body._additionalProperties() /** Additional headers to send with the request. */ @@ -113,11 +174,61 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: + * - [corporation] + * - [governmentAuthority] + * - [naturalPerson] * - [riskRating] * - [thirdPartyVerification] + * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Details of the corporation entity to update. */ + fun corporation(corporation: Corporation) = apply { body.corporation(corporation) } + + /** + * Sets [Builder.corporation] to an arbitrary JSON value. + * + * You should usually call [Builder.corporation] with a well-typed [Corporation] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun corporation(corporation: JsonField) = apply { + body.corporation(corporation) + } + + /** Details of the government authority entity to update. */ + fun governmentAuthority(governmentAuthority: GovernmentAuthority) = apply { + body.governmentAuthority(governmentAuthority) + } + + /** + * Sets [Builder.governmentAuthority] to an arbitrary JSON value. + * + * You should usually call [Builder.governmentAuthority] with a well-typed + * [GovernmentAuthority] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun governmentAuthority(governmentAuthority: JsonField) = apply { + body.governmentAuthority(governmentAuthority) + } + + /** Details of the natural person entity to update. */ + fun naturalPerson(naturalPerson: NaturalPerson) = apply { + body.naturalPerson(naturalPerson) + } + + /** + * Sets [Builder.naturalPerson] to an arbitrary JSON value. + * + * You should usually call [Builder.naturalPerson] with a well-typed [NaturalPerson] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun naturalPerson(naturalPerson: JsonField) = apply { + body.naturalPerson(naturalPerson) + } + /** * An assessment of the entity’s potential risk of involvement in financial crimes, such as * money laundering. @@ -153,6 +264,17 @@ private constructor( body.thirdPartyVerification(thirdPartyVerification) } + /** Details of the trust entity to update. */ + fun trust(trust: Trust) = apply { body.trust(trust) } + + /** + * Sets [Builder.trust] to an arbitrary JSON value. + * + * You should usually call [Builder.trust] with a well-typed [Trust] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun trust(trust: JsonField) = apply { body.trust(trust) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -251,105 +373,746 @@ private constructor( additionalQueryParams.replace(key, value) } - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) + 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 [EntityUpdateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): EntityUpdateParams = + EntityUpdateParams( + 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 + private constructor( + private val corporation: JsonField, + private val governmentAuthority: JsonField, + private val naturalPerson: JsonField, + private val riskRating: JsonField, + private val thirdPartyVerification: JsonField, + private val trust: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("corporation") + @ExcludeMissing + corporation: JsonField = JsonMissing.of(), + @JsonProperty("government_authority") + @ExcludeMissing + governmentAuthority: JsonField = JsonMissing.of(), + @JsonProperty("natural_person") + @ExcludeMissing + naturalPerson: JsonField = JsonMissing.of(), + @JsonProperty("risk_rating") + @ExcludeMissing + riskRating: JsonField = JsonMissing.of(), + @JsonProperty("third_party_verification") + @ExcludeMissing + thirdPartyVerification: JsonField = JsonMissing.of(), + @JsonProperty("trust") @ExcludeMissing trust: JsonField = JsonMissing.of(), + ) : this( + corporation, + governmentAuthority, + naturalPerson, + riskRating, + thirdPartyVerification, + trust, + mutableMapOf(), + ) + + /** + * Details of the corporation entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun corporation(): Optional = corporation.getOptional("corporation") + + /** + * Details of the government authority entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun governmentAuthority(): Optional = + governmentAuthority.getOptional("government_authority") + + /** + * Details of the natural person entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun naturalPerson(): Optional = naturalPerson.getOptional("natural_person") + + /** + * An assessment of the entity’s potential risk of involvement in financial crimes, such as + * money laundering. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun riskRating(): Optional = riskRating.getOptional("risk_rating") + + /** + * A reference to data stored in a third-party verification service. Your integration may or + * may not use this field. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun thirdPartyVerification(): Optional = + thirdPartyVerification.getOptional("third_party_verification") + + /** + * Details of the trust entity to update. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun trust(): Optional = trust.getOptional("trust") + + /** + * Returns the raw JSON value of [corporation]. + * + * Unlike [corporation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("corporation") + @ExcludeMissing + fun _corporation(): JsonField = corporation + + /** + * Returns the raw JSON value of [governmentAuthority]. + * + * Unlike [governmentAuthority], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("government_authority") + @ExcludeMissing + fun _governmentAuthority(): JsonField = governmentAuthority + + /** + * Returns the raw JSON value of [naturalPerson]. + * + * Unlike [naturalPerson], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("natural_person") + @ExcludeMissing + fun _naturalPerson(): JsonField = naturalPerson + + /** + * Returns the raw JSON value of [riskRating]. + * + * Unlike [riskRating], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("risk_rating") + @ExcludeMissing + fun _riskRating(): JsonField = riskRating + + /** + * Returns the raw JSON value of [thirdPartyVerification]. + * + * Unlike [thirdPartyVerification], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("third_party_verification") + @ExcludeMissing + fun _thirdPartyVerification(): JsonField = thirdPartyVerification + + /** + * Returns the raw JSON value of [trust]. + * + * Unlike [trust], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("trust") @ExcludeMissing fun _trust(): JsonField = trust + + @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]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var corporation: JsonField = JsonMissing.of() + private var governmentAuthority: JsonField = JsonMissing.of() + private var naturalPerson: JsonField = JsonMissing.of() + private var riskRating: JsonField = JsonMissing.of() + private var thirdPartyVerification: JsonField = JsonMissing.of() + private var trust: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + corporation = body.corporation + governmentAuthority = body.governmentAuthority + naturalPerson = body.naturalPerson + riskRating = body.riskRating + thirdPartyVerification = body.thirdPartyVerification + trust = body.trust + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** Details of the corporation entity to update. */ + fun corporation(corporation: Corporation) = corporation(JsonField.of(corporation)) + + /** + * Sets [Builder.corporation] to an arbitrary JSON value. + * + * You should usually call [Builder.corporation] with a well-typed [Corporation] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun corporation(corporation: JsonField) = apply { + this.corporation = corporation + } + + /** Details of the government authority entity to update. */ + fun governmentAuthority(governmentAuthority: GovernmentAuthority) = + governmentAuthority(JsonField.of(governmentAuthority)) + + /** + * Sets [Builder.governmentAuthority] to an arbitrary JSON value. + * + * You should usually call [Builder.governmentAuthority] with a well-typed + * [GovernmentAuthority] value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun governmentAuthority(governmentAuthority: JsonField) = apply { + this.governmentAuthority = governmentAuthority + } + + /** Details of the natural person entity to update. */ + fun naturalPerson(naturalPerson: NaturalPerson) = + naturalPerson(JsonField.of(naturalPerson)) + + /** + * Sets [Builder.naturalPerson] to an arbitrary JSON value. + * + * You should usually call [Builder.naturalPerson] with a well-typed [NaturalPerson] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun naturalPerson(naturalPerson: JsonField) = apply { + this.naturalPerson = naturalPerson + } + + /** + * An assessment of the entity’s potential risk of involvement in financial crimes, such + * as money laundering. + */ + fun riskRating(riskRating: RiskRating) = riskRating(JsonField.of(riskRating)) + + /** + * Sets [Builder.riskRating] to an arbitrary JSON value. + * + * You should usually call [Builder.riskRating] with a well-typed [RiskRating] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun riskRating(riskRating: JsonField) = apply { + this.riskRating = riskRating + } + + /** + * A reference to data stored in a third-party verification service. Your integration + * may or may not use this field. + */ + fun thirdPartyVerification(thirdPartyVerification: ThirdPartyVerification) = + thirdPartyVerification(JsonField.of(thirdPartyVerification)) + + /** + * Sets [Builder.thirdPartyVerification] to an arbitrary JSON value. + * + * You should usually call [Builder.thirdPartyVerification] with a well-typed + * [ThirdPartyVerification] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun thirdPartyVerification(thirdPartyVerification: JsonField) = + apply { + this.thirdPartyVerification = thirdPartyVerification + } + + /** Details of the trust entity to update. */ + fun trust(trust: Trust) = trust(JsonField.of(trust)) + + /** + * Sets [Builder.trust] to an arbitrary JSON value. + * + * You should usually call [Builder.trust] with a well-typed [Trust] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun trust(trust: JsonField) = apply { this.trust = trust } + + 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. + */ + fun build(): Body = + Body( + corporation, + governmentAuthority, + naturalPerson, + riskRating, + thirdPartyVerification, + trust, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + corporation().ifPresent { it.validate() } + governmentAuthority().ifPresent { it.validate() } + naturalPerson().ifPresent { it.validate() } + riskRating().ifPresent { it.validate() } + thirdPartyVerification().ifPresent { it.validate() } + trust().ifPresent { it.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 = + (corporation.asKnown().getOrNull()?.validity() ?: 0) + + (governmentAuthority.asKnown().getOrNull()?.validity() ?: 0) + + (naturalPerson.asKnown().getOrNull()?.validity() ?: 0) + + (riskRating.asKnown().getOrNull()?.validity() ?: 0) + + (thirdPartyVerification.asKnown().getOrNull()?.validity() ?: 0) + + (trust.asKnown().getOrNull()?.validity() ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + corporation == other.corporation && + governmentAuthority == other.governmentAuthority && + naturalPerson == other.naturalPerson && + riskRating == other.riskRating && + thirdPartyVerification == other.thirdPartyVerification && + trust == other.trust && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + corporation, + governmentAuthority, + naturalPerson, + riskRating, + thirdPartyVerification, + trust, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{corporation=$corporation, governmentAuthority=$governmentAuthority, naturalPerson=$naturalPerson, riskRating=$riskRating, thirdPartyVerification=$thirdPartyVerification, trust=$trust, additionalProperties=$additionalProperties}" + } + + /** Details of the corporation entity to update. */ + class Corporation + private constructor( + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + + /** + * The legal name of the corporation. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [Corporation]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Corporation]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(corporation: Corporation) = apply { + name = corporation.name + additionalProperties = corporation.additionalProperties.toMutableMap() + } + + /** The legal name of the corporation. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [Corporation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Corporation = Corporation(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Corporation = apply { + if (validated) { + return@apply + } + + name() + 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 (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Corporation && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Corporation{name=$name, additionalProperties=$additionalProperties}" + } + + /** Details of the government authority entity to update. */ + class GovernmentAuthority + private constructor( + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + + /** + * The legal name of the government authority. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [GovernmentAuthority]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [GovernmentAuthority]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(governmentAuthority: GovernmentAuthority) = apply { + name = governmentAuthority.name + additionalProperties = governmentAuthority.additionalProperties.toMutableMap() + } + + /** The legal name of the government authority. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [GovernmentAuthority]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): GovernmentAuthority = + GovernmentAuthority(name, additionalProperties.toMutableMap()) } - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } + private var validated: Boolean = false - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) + fun validate(): GovernmentAuthority = apply { + if (validated) { + return@apply } - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) + name() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + /** - * Returns an immutable instance of [EntityUpdateParams]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Further updates to this [Builder] will not mutate the returned instance. + * Used for best match union deserialization. */ - fun build(): EntityUpdateParams = - EntityUpdateParams( - entityId, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } + @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) - fun _body(): Body = body + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun _pathParam(index: Int): String = - when (index) { - 0 -> entityId ?: "" - else -> "" + return other is GovernmentAuthority && + name == other.name && + additionalProperties == other.additionalProperties } - override fun _headers(): Headers = additionalHeaders + private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } - override fun _queryParams(): QueryParams = additionalQueryParams + override fun hashCode(): Int = hashCode - class Body + override fun toString() = + "GovernmentAuthority{name=$name, additionalProperties=$additionalProperties}" + } + + /** Details of the natural person entity to update. */ + class NaturalPerson private constructor( - private val riskRating: JsonField, - private val thirdPartyVerification: JsonField, + private val name: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("risk_rating") - @ExcludeMissing - riskRating: JsonField = JsonMissing.of(), - @JsonProperty("third_party_verification") - @ExcludeMissing - thirdPartyVerification: JsonField = JsonMissing.of(), - ) : this(riskRating, thirdPartyVerification, mutableMapOf()) - - /** - * An assessment of the entity’s potential risk of involvement in financial crimes, such as - * money laundering. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun riskRating(): Optional = riskRating.getOptional("risk_rating") + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) /** - * A reference to data stored in a third-party verification service. Your integration may or - * may not use this field. + * The legal name of the natural person. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun thirdPartyVerification(): Optional = - thirdPartyVerification.getOptional("third_party_verification") - - /** - * Returns the raw JSON value of [riskRating]. - * - * Unlike [riskRating], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("risk_rating") - @ExcludeMissing - fun _riskRating(): JsonField = riskRating + fun name(): Optional = name.getOptional("name") /** - * Returns the raw JSON value of [thirdPartyVerification]. + * Returns the raw JSON value of [name]. * - * Unlike [thirdPartyVerification], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("third_party_verification") - @ExcludeMissing - fun _thirdPartyVerification(): JsonField = thirdPartyVerification + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -365,59 +1128,33 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [Body]. */ + /** Returns a mutable builder for constructing an instance of [NaturalPerson]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [Body]. */ + /** A builder for [NaturalPerson]. */ class Builder internal constructor() { - private var riskRating: JsonField = JsonMissing.of() - private var thirdPartyVerification: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(body: Body) = apply { - riskRating = body.riskRating - thirdPartyVerification = body.thirdPartyVerification - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** - * An assessment of the entity’s potential risk of involvement in financial crimes, such - * as money laundering. - */ - fun riskRating(riskRating: RiskRating) = riskRating(JsonField.of(riskRating)) - - /** - * Sets [Builder.riskRating] to an arbitrary JSON value. - * - * You should usually call [Builder.riskRating] with a well-typed [RiskRating] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun riskRating(riskRating: JsonField) = apply { - this.riskRating = riskRating + internal fun from(naturalPerson: NaturalPerson) = apply { + name = naturalPerson.name + additionalProperties = naturalPerson.additionalProperties.toMutableMap() } - /** - * A reference to data stored in a third-party verification service. Your integration - * may or may not use this field. - */ - fun thirdPartyVerification(thirdPartyVerification: ThirdPartyVerification) = - thirdPartyVerification(JsonField.of(thirdPartyVerification)) + /** The legal name of the natural person. */ + fun name(name: String) = name(JsonField.of(name)) /** - * Sets [Builder.thirdPartyVerification] to an arbitrary JSON value. + * Sets [Builder.name] to an arbitrary JSON value. * - * You should usually call [Builder.thirdPartyVerification] with a well-typed - * [ThirdPartyVerification] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun thirdPartyVerification(thirdPartyVerification: JsonField) = - apply { - this.thirdPartyVerification = thirdPartyVerification - } + fun name(name: JsonField) = apply { this.name = name } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -439,23 +1176,21 @@ private constructor( } /** - * Returns an immutable instance of [Body]. + * Returns an immutable instance of [NaturalPerson]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Body = - Body(riskRating, thirdPartyVerification, additionalProperties.toMutableMap()) + fun build(): NaturalPerson = NaturalPerson(name, additionalProperties.toMutableMap()) } private var validated: Boolean = false - fun validate(): Body = apply { + fun validate(): NaturalPerson = apply { if (validated) { return@apply } - riskRating().ifPresent { it.validate() } - thirdPartyVerification().ifPresent { it.validate() } + name() validated = true } @@ -473,30 +1208,24 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - (riskRating.asKnown().getOrNull()?.validity() ?: 0) + - (thirdPartyVerification.asKnown().getOrNull()?.validity() ?: 0) + @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Body && - riskRating == other.riskRating && - thirdPartyVerification == other.thirdPartyVerification && + return other is NaturalPerson && + name == other.name && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash(riskRating, thirdPartyVerification, additionalProperties) - } + private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Body{riskRating=$riskRating, thirdPartyVerification=$thirdPartyVerification, additionalProperties=$additionalProperties}" + "NaturalPerson{name=$name, additionalProperties=$additionalProperties}" } /** @@ -1201,6 +1930,146 @@ private constructor( "ThirdPartyVerification{reference=$reference, vendor=$vendor, additionalProperties=$additionalProperties}" } + /** Details of the trust entity to update. */ + class Trust + private constructor( + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() + ) : this(name, mutableMapOf()) + + /** + * The legal name of the trust. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @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 [Trust]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Trust]. */ + class Builder internal constructor() { + + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(trust: Trust) = apply { + name = trust.name + additionalProperties = trust.additionalProperties.toMutableMap() + } + + /** The legal name of the trust. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + 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 [Trust]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Trust = Trust(name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Trust = apply { + if (validated) { + return@apply + } + + name() + 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 (name.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Trust && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Trust{name=$name, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateParamsTest.kt index 6073d8e72..ffd0c8c26 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityUpdateParamsTest.kt @@ -12,6 +12,9 @@ internal class EntityUpdateParamsTest { fun create() { EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") + .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .governmentAuthority(EntityUpdateParams.GovernmentAuthority.builder().name("x").build()) + .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -24,6 +27,7 @@ internal class EntityUpdateParamsTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) + .trust(EntityUpdateParams.Trust.builder().name("x").build()) .build() } @@ -41,6 +45,11 @@ internal class EntityUpdateParamsTest { val params = EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") + .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .governmentAuthority( + EntityUpdateParams.GovernmentAuthority.builder().name("x").build() + ) + .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -53,10 +62,17 @@ internal class EntityUpdateParamsTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) + .trust(EntityUpdateParams.Trust.builder().name("x").build()) .build() val body = params._body() + assertThat(body.corporation()) + .contains(EntityUpdateParams.Corporation.builder().name("x").build()) + assertThat(body.governmentAuthority()) + .contains(EntityUpdateParams.GovernmentAuthority.builder().name("x").build()) + assertThat(body.naturalPerson()) + .contains(EntityUpdateParams.NaturalPerson.builder().name("x").build()) assertThat(body.riskRating()) .contains( EntityUpdateParams.RiskRating.builder() @@ -71,6 +87,7 @@ internal class EntityUpdateParamsTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) + assertThat(body.trust()).contains(EntityUpdateParams.Trust.builder().name("x").build()) } @Test diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt index 9654830af..3ba36c120 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt @@ -483,6 +483,11 @@ internal class EntityServiceAsyncTest { entityServiceAsync.update( EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") + .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .governmentAuthority( + EntityUpdateParams.GovernmentAuthority.builder().name("x").build() + ) + .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -495,6 +500,7 @@ internal class EntityServiceAsyncTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) + .trust(EntityUpdateParams.Trust.builder().name("x").build()) .build() ) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt index 466488677..a16120fa3 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt @@ -481,6 +481,11 @@ internal class EntityServiceTest { entityService.update( EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") + .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .governmentAuthority( + EntityUpdateParams.GovernmentAuthority.builder().name("x").build() + ) + .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -493,6 +498,7 @@ internal class EntityServiceTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) + .trust(EntityUpdateParams.Trust.builder().name("x").build()) .build() )