diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 34760ea6d..bd0a4378e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.317.0" + ".": "0.318.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 09d98d352..94d9b0a5f 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-98bb100223960756975a05c102fb497e2dba7857b02bec559ebc60d6c38d78e4.yml -openapi_spec_hash: b19fcec9237b7b3394002cfb662b391f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-17c08bdd306c9bcf444a3d09db8878f633ec996cd2f091e1173742f6f3ffc5a5.yml +openapi_spec_hash: 70c131085fc22b07df6bac0f70fcf468 config_hash: e1885b38eded054b77308a024c5d80cc diff --git a/CHANGELOG.md b/CHANGELOG.md index d273387eb..52c9fecda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.318.0 (2025-09-08) + +Full Changelog: [v0.317.0...v0.318.0](https://github.com/Increase/increase-java/compare/v0.317.0...v0.318.0) + +### Features + +* **api:** api update ([c4396ff](https://github.com/Increase/increase-java/commit/c4396ffddbc3e5eeacf2aa87be59de96bea360f2)) + ## 0.317.0 (2025-09-07) Full Changelog: [v0.316.0...v0.317.0](https://github.com/Increase/increase-java/compare/v0.316.0...v0.317.0) diff --git a/README.md b/README.md index 84d68c453..75247c6b3 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.317.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.317.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.317.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.318.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.318.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.318.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.317.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.318.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.317.0") +implementation("com.increase.api:increase-java:0.318.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.317.0") com.increase.api increase-java - 0.317.0 + 0.318.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 87d67e453..8f08233d9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.317.0" // x-release-please-version + version = "0.318.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 2a3873339..86e5ad734 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 @@ -842,14 +842,25 @@ private constructor( */ class Corporation private constructor( + private val address: JsonField
, private val name: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() - ) : this(name, mutableMapOf()) + @JsonProperty("address") @ExcludeMissing address: JsonField
= JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(address, name, mutableMapOf()) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address(): Optional
= address.getOptional("address") /** * The legal name of the corporation. @@ -859,6 +870,13 @@ private constructor( */ fun name(): Optional = name.getOptional("name") + /** + * Returns the raw JSON value of [address]. + * + * Unlike [address], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("address") @ExcludeMissing fun _address(): JsonField
= address + /** * Returns the raw JSON value of [name]. * @@ -887,15 +905,32 @@ private constructor( /** A builder for [Corporation]. */ class Builder internal constructor() { + private var address: JsonField
= JsonMissing.of() private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(corporation: Corporation) = apply { + address = corporation.address name = corporation.name additionalProperties = corporation.additionalProperties.toMutableMap() } + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + fun address(address: Address) = address(JsonField.of(address)) + + /** + * Sets [Builder.address] to an arbitrary JSON value. + * + * You should usually call [Builder.address] with a well-typed [Address] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun address(address: JsonField
) = apply { this.address = address } + /** The legal name of the corporation. */ fun name(name: String) = name(JsonField.of(name)) @@ -932,7 +967,8 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Corporation = Corporation(name, additionalProperties.toMutableMap()) + fun build(): Corporation = + Corporation(address, name, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -942,6 +978,7 @@ private constructor( return@apply } + address().ifPresent { it.validate() } name() validated = true } @@ -960,7 +997,333 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun validity(): Int = + (address.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + class Address + private constructor( + private val city: JsonField, + private val line1: JsonField, + private val state: JsonField, + private val zip: JsonField, + private val line2: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), + @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), + ) : this(city, line1, state, zip, line2, mutableMapOf()) + + /** + * The city of the address. + * + * @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 city(): String = city.getRequired("city") + + /** + * The first line of the address. This is usually the street number and street. + * + * @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 line1(): String = line1.getRequired("line1") + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of the + * address. + * + * @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 state(): String = state.getRequired("state") + + /** + * The ZIP code of the address. + * + * @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 zip(): String = zip.getRequired("zip") + + /** + * The second line of the address. This might be the floor or room number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun line2(): Optional = line2.getOptional("line2") + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [zip]. + * + * Unlike [zip], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("zip") @ExcludeMissing fun _zip(): JsonField = zip + + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + + @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 [Address]. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Address]. */ + class Builder internal constructor() { + + private var city: JsonField? = null + private var line1: JsonField? = null + private var state: JsonField? = null + private var zip: JsonField? = null + private var line2: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(address: Address) = apply { + city = address.city + line1 = address.line1 + state = address.state + zip = address.zip + line2 = address.line2 + additionalProperties = address.additionalProperties.toMutableMap() + } + + /** The city of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** The first line of the address. This is usually the street number and street. */ + fun line1(line1: String) = line1(JsonField.of(line1)) + + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line1(line1: JsonField) = apply { this.line1 = line1 } + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of + * the address. + */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The ZIP code of the address. */ + fun zip(zip: String) = zip(JsonField.of(zip)) + + /** + * Sets [Builder.zip] to an arbitrary JSON value. + * + * You should usually call [Builder.zip] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun zip(zip: JsonField) = apply { this.zip = zip } + + /** The second line of the address. This might be the floor or room number. */ + fun line2(line2: String) = line2(JsonField.of(line2)) + + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line2(line2: JsonField) = apply { this.line2 = line2 } + + 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 [Address]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Address = + Address( + checkRequired("city", city), + checkRequired("line1", line1), + checkRequired("state", state), + checkRequired("zip", zip), + line2, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Address = apply { + if (validated) { + return@apply + } + + city() + line1() + state() + zip() + line2() + 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 (city.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (zip.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Address && + city == other.city && + line1 == other.line1 && + state == other.state && + zip == other.zip && + line2 == other.line2 && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(city, line1, state, zip, line2, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Address{city=$city, line1=$line1, state=$state, zip=$zip, line2=$line2, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -968,16 +1331,17 @@ private constructor( } return other is Corporation && + address == other.address && name == other.name && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(address, name, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Corporation{name=$name, additionalProperties=$additionalProperties}" + "Corporation{address=$address, name=$name, additionalProperties=$additionalProperties}" } /** @@ -986,14 +1350,25 @@ private constructor( */ class GovernmentAuthority private constructor( + private val address: JsonField
, private val name: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() - ) : this(name, mutableMapOf()) + @JsonProperty("address") @ExcludeMissing address: JsonField
= JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(address, name, mutableMapOf()) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address(): Optional
= address.getOptional("address") /** * The legal name of the government authority. @@ -1003,6 +1378,13 @@ private constructor( */ fun name(): Optional = name.getOptional("name") + /** + * Returns the raw JSON value of [address]. + * + * Unlike [address], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("address") @ExcludeMissing fun _address(): JsonField
= address + /** * Returns the raw JSON value of [name]. * @@ -1031,15 +1413,32 @@ private constructor( /** A builder for [GovernmentAuthority]. */ class Builder internal constructor() { + private var address: JsonField
= JsonMissing.of() private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(governmentAuthority: GovernmentAuthority) = apply { + address = governmentAuthority.address name = governmentAuthority.name additionalProperties = governmentAuthority.additionalProperties.toMutableMap() } + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + fun address(address: Address) = address(JsonField.of(address)) + + /** + * Sets [Builder.address] to an arbitrary JSON value. + * + * You should usually call [Builder.address] with a well-typed [Address] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun address(address: JsonField
) = apply { this.address = address } + /** The legal name of the government authority. */ fun name(name: String) = name(JsonField.of(name)) @@ -1077,7 +1476,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): GovernmentAuthority = - GovernmentAuthority(name, additionalProperties.toMutableMap()) + GovernmentAuthority(address, name, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -1087,6 +1486,7 @@ private constructor( return@apply } + address().ifPresent { it.validate() } name() validated = true } @@ -1105,7 +1505,333 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun validity(): Int = + (address.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + class Address + private constructor( + private val city: JsonField, + private val line1: JsonField, + private val state: JsonField, + private val zip: JsonField, + private val line2: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), + @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), + ) : this(city, line1, state, zip, line2, mutableMapOf()) + + /** + * The city of the address. + * + * @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 city(): String = city.getRequired("city") + + /** + * The first line of the address. This is usually the street number and street. + * + * @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 line1(): String = line1.getRequired("line1") + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of the + * address. + * + * @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 state(): String = state.getRequired("state") + + /** + * The ZIP code of the address. + * + * @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 zip(): String = zip.getRequired("zip") + + /** + * The second line of the address. This might be the floor or room number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun line2(): Optional = line2.getOptional("line2") + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [zip]. + * + * Unlike [zip], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("zip") @ExcludeMissing fun _zip(): JsonField = zip + + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + + @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 [Address]. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Address]. */ + class Builder internal constructor() { + + private var city: JsonField? = null + private var line1: JsonField? = null + private var state: JsonField? = null + private var zip: JsonField? = null + private var line2: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(address: Address) = apply { + city = address.city + line1 = address.line1 + state = address.state + zip = address.zip + line2 = address.line2 + additionalProperties = address.additionalProperties.toMutableMap() + } + + /** The city of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** The first line of the address. This is usually the street number and street. */ + fun line1(line1: String) = line1(JsonField.of(line1)) + + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line1(line1: JsonField) = apply { this.line1 = line1 } + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of + * the address. + */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The ZIP code of the address. */ + fun zip(zip: String) = zip(JsonField.of(zip)) + + /** + * Sets [Builder.zip] to an arbitrary JSON value. + * + * You should usually call [Builder.zip] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun zip(zip: JsonField) = apply { this.zip = zip } + + /** The second line of the address. This might be the floor or room number. */ + fun line2(line2: String) = line2(JsonField.of(line2)) + + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line2(line2: JsonField) = apply { this.line2 = line2 } + + 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 [Address]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Address = + Address( + checkRequired("city", city), + checkRequired("line1", line1), + checkRequired("state", state), + checkRequired("zip", zip), + line2, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Address = apply { + if (validated) { + return@apply + } + + city() + line1() + state() + zip() + line2() + 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 (city.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (zip.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Address && + city == other.city && + line1 == other.line1 && + state == other.state && + zip == other.zip && + line2 == other.line2 && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(city, line1, state, zip, line2, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Address{city=$city, line1=$line1, state=$state, zip=$zip, line2=$line2, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1113,16 +1839,17 @@ private constructor( } return other is GovernmentAuthority && + address == other.address && name == other.name && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(address, name, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "GovernmentAuthority{name=$name, additionalProperties=$additionalProperties}" + "GovernmentAuthority{address=$address, name=$name, additionalProperties=$additionalProperties}" } /** @@ -1131,14 +1858,25 @@ private constructor( */ class NaturalPerson private constructor( + private val address: JsonField
, private val name: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() - ) : this(name, mutableMapOf()) + @JsonProperty("address") @ExcludeMissing address: JsonField
= JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(address, name, mutableMapOf()) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address(): Optional
= address.getOptional("address") /** * The legal name of the natural person. @@ -1148,6 +1886,13 @@ private constructor( */ fun name(): Optional = name.getOptional("name") + /** + * Returns the raw JSON value of [address]. + * + * Unlike [address], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("address") @ExcludeMissing fun _address(): JsonField
= address + /** * Returns the raw JSON value of [name]. * @@ -1155,101 +1900,446 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + @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 [NaturalPerson]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [NaturalPerson]. */ + class Builder internal constructor() { + + private var address: JsonField
= JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(naturalPerson: NaturalPerson) = apply { + address = naturalPerson.address + name = naturalPerson.name + additionalProperties = naturalPerson.additionalProperties.toMutableMap() + } + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + fun address(address: Address) = address(JsonField.of(address)) + + /** + * Sets [Builder.address] to an arbitrary JSON value. + * + * You should usually call [Builder.address] with a well-typed [Address] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun address(address: JsonField
) = apply { this.address = address } + + /** The legal name of the natural person. */ + 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 [NaturalPerson]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): NaturalPerson = + NaturalPerson(address, name, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): NaturalPerson = apply { + if (validated) { + return@apply + } + + address().ifPresent { it.validate() } + 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 = + (address.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + class Address + private constructor( + private val city: JsonField, + private val line1: JsonField, + private val state: JsonField, + private val zip: JsonField, + private val line2: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), + @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), + ) : this(city, line1, state, zip, line2, mutableMapOf()) + + /** + * The city of the address. + * + * @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 city(): String = city.getRequired("city") + + /** + * The first line of the address. This is usually the street number and street. + * + * @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 line1(): String = line1.getRequired("line1") + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of the + * address. + * + * @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 state(): String = state.getRequired("state") + + /** + * The ZIP code of the address. + * + * @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 zip(): String = zip.getRequired("zip") + + /** + * The second line of the address. This might be the floor or room number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun line2(): Optional = line2.getOptional("line2") + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [zip]. + * + * Unlike [zip], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("zip") @ExcludeMissing fun _zip(): JsonField = zip + + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + + @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 [Address]. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Address]. */ + class Builder internal constructor() { + + private var city: JsonField? = null + private var line1: JsonField? = null + private var state: JsonField? = null + private var zip: JsonField? = null + private var line2: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(address: Address) = apply { + city = address.city + line1 = address.line1 + state = address.state + zip = address.zip + line2 = address.line2 + additionalProperties = address.additionalProperties.toMutableMap() + } + + /** The city of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** The first line of the address. This is usually the street number and street. */ + fun line1(line1: String) = line1(JsonField.of(line1)) + + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line1(line1: JsonField) = apply { this.line1 = line1 } + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of + * the address. + */ + fun state(state: String) = state(JsonField.of(state)) - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } - fun toBuilder() = Builder().from(this) + /** The ZIP code of the address. */ + fun zip(zip: String) = zip(JsonField.of(zip)) - companion object { + /** + * Sets [Builder.zip] to an arbitrary JSON value. + * + * You should usually call [Builder.zip] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun zip(zip: JsonField) = apply { this.zip = zip } - /** Returns a mutable builder for constructing an instance of [NaturalPerson]. */ - @JvmStatic fun builder() = Builder() - } + /** The second line of the address. This might be the floor or room number. */ + fun line2(line2: String) = line2(JsonField.of(line2)) - /** A builder for [NaturalPerson]. */ - class Builder internal constructor() { + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line2(line2: JsonField) = apply { this.line2 = line2 } - private var name: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - @JvmSynthetic - internal fun from(naturalPerson: NaturalPerson) = apply { - name = naturalPerson.name - additionalProperties = naturalPerson.additionalProperties.toMutableMap() - } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The legal name of the natural person. */ - fun name(name: String) = name(JsonField.of(name)) + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * 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 removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an immutable instance of [Address]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Address = + Address( + checkRequired("city", city), + checkRequired("line1", line1), + checkRequired("state", state), + checkRequired("zip", zip), + line2, + additionalProperties.toMutableMap(), + ) } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + private var validated: Boolean = false - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + fun validate(): Address = apply { + if (validated) { + return@apply + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + city() + line1() + state() + zip() + line2() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + /** - * Returns an immutable instance of [NaturalPerson]. + * 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(): NaturalPerson = NaturalPerson(name, additionalProperties.toMutableMap()) - } + @JvmSynthetic + internal fun validity(): Int = + (if (city.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (zip.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) - private var validated: Boolean = false + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - fun validate(): NaturalPerson = apply { - if (validated) { - return@apply + return other is Address && + city == other.city && + line1 == other.line1 && + state == other.state && + zip == other.zip && + line2 == other.line2 && + additionalProperties == other.additionalProperties } - name() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: IncreaseInvalidDataException) { - false + private val hashCode: Int by lazy { + Objects.hash(city, line1, state, zip, line2, additionalProperties) } - /** - * 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 hashCode(): Int = hashCode + + override fun toString() = + "Address{city=$city, line1=$line1, state=$state, zip=$zip, line2=$line2, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -1257,16 +2347,17 @@ private constructor( } return other is NaturalPerson && + address == other.address && name == other.name && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(address, name, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "NaturalPerson{name=$name, additionalProperties=$additionalProperties}" + "NaturalPerson{address=$address, name=$name, additionalProperties=$additionalProperties}" } /** @@ -1977,14 +3068,25 @@ private constructor( */ class Trust private constructor( + private val address: JsonField
, private val name: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of() - ) : this(name, mutableMapOf()) + @JsonProperty("address") @ExcludeMissing address: JsonField
= JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(address, name, mutableMapOf()) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun address(): Optional
= address.getOptional("address") /** * The legal name of the trust. @@ -1994,6 +3096,13 @@ private constructor( */ fun name(): Optional = name.getOptional("name") + /** + * Returns the raw JSON value of [address]. + * + * Unlike [address], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("address") @ExcludeMissing fun _address(): JsonField
= address + /** * Returns the raw JSON value of [name]. * @@ -2022,15 +3131,32 @@ private constructor( /** A builder for [Trust]. */ class Builder internal constructor() { + private var address: JsonField
= JsonMissing.of() private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(trust: Trust) = apply { + address = trust.address name = trust.name additionalProperties = trust.additionalProperties.toMutableMap() } + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + fun address(address: Address) = address(JsonField.of(address)) + + /** + * Sets [Builder.address] to an arbitrary JSON value. + * + * You should usually call [Builder.address] with a well-typed [Address] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun address(address: JsonField
) = apply { this.address = address } + /** The legal name of the trust. */ fun name(name: String) = name(JsonField.of(name)) @@ -2067,7 +3193,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): Trust = Trust(name, additionalProperties.toMutableMap()) + fun build(): Trust = Trust(address, name, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -2077,6 +3203,7 @@ private constructor( return@apply } + address().ifPresent { it.validate() } name() validated = true } @@ -2095,7 +3222,333 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun validity(): Int = + (address.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** + * The entity's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + class Address + private constructor( + private val city: JsonField, + private val line1: JsonField, + private val state: JsonField, + private val zip: JsonField, + private val line2: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("line1") @ExcludeMissing line1: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("zip") @ExcludeMissing zip: JsonField = JsonMissing.of(), + @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), + ) : this(city, line1, state, zip, line2, mutableMapOf()) + + /** + * The city of the address. + * + * @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 city(): String = city.getRequired("city") + + /** + * The first line of the address. This is usually the street number and street. + * + * @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 line1(): String = line1.getRequired("line1") + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of the + * address. + * + * @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 state(): String = state.getRequired("state") + + /** + * The ZIP code of the address. + * + * @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 zip(): String = zip.getRequired("zip") + + /** + * The second line of the address. This might be the floor or room number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun line2(): Optional = line2.getOptional("line2") + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [line1]. + * + * Unlike [line1], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1 + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [zip]. + * + * Unlike [zip], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("zip") @ExcludeMissing fun _zip(): JsonField = zip + + /** + * Returns the raw JSON value of [line2]. + * + * Unlike [line2], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + + @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 [Address]. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Address]. */ + class Builder internal constructor() { + + private var city: JsonField? = null + private var line1: JsonField? = null + private var state: JsonField? = null + private var zip: JsonField? = null + private var line2: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(address: Address) = apply { + city = address.city + line1 = address.line1 + state = address.state + zip = address.zip + line2 = address.line2 + additionalProperties = address.additionalProperties.toMutableMap() + } + + /** The city of the address. */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** The first line of the address. This is usually the street number and street. */ + fun line1(line1: String) = line1(JsonField.of(line1)) + + /** + * Sets [Builder.line1] to an arbitrary JSON value. + * + * You should usually call [Builder.line1] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line1(line1: JsonField) = apply { this.line1 = line1 } + + /** + * The two-letter United States Postal Service (USPS) abbreviation for the state of + * the address. + */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** The ZIP code of the address. */ + fun zip(zip: String) = zip(JsonField.of(zip)) + + /** + * Sets [Builder.zip] to an arbitrary JSON value. + * + * You should usually call [Builder.zip] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun zip(zip: JsonField) = apply { this.zip = zip } + + /** The second line of the address. This might be the floor or room number. */ + fun line2(line2: String) = line2(JsonField.of(line2)) + + /** + * Sets [Builder.line2] to an arbitrary JSON value. + * + * You should usually call [Builder.line2] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun line2(line2: JsonField) = apply { this.line2 = line2 } + + 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 [Address]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .city() + * .line1() + * .state() + * .zip() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Address = + Address( + checkRequired("city", city), + checkRequired("line1", line1), + checkRequired("state", state), + checkRequired("zip", zip), + line2, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Address = apply { + if (validated) { + return@apply + } + + city() + line1() + state() + zip() + line2() + 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 (city.asKnown().isPresent) 1 else 0) + + (if (line1.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (zip.asKnown().isPresent) 1 else 0) + + (if (line2.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Address && + city == other.city && + line1 == other.line1 && + state == other.state && + zip == other.zip && + line2 == other.line2 && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(city, line1, state, zip, line2, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Address{city=$city, line1=$line1, state=$state, zip=$zip, line2=$line2, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -2103,15 +3556,17 @@ private constructor( } return other is Trust && + address == other.address && name == other.name && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(name, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(address, name, additionalProperties) } override fun hashCode(): Int = hashCode - override fun toString() = "Trust{name=$name, additionalProperties=$additionalProperties}" + override fun toString() = + "Trust{address=$address, name=$name, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { 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 ffd0c8c26..fee573f09 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,9 +12,48 @@ 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()) + .corporation( + EntityUpdateParams.Corporation.builder() + .address( + EntityUpdateParams.Corporation.Address.builder() + .city("New York") + .line1("33 Liberty Street") + .state("NY") + .zip("10045") + .line2("Unit 2") + .build() + ) + .name("x") + .build() + ) + .governmentAuthority( + EntityUpdateParams.GovernmentAuthority.builder() + .address( + EntityUpdateParams.GovernmentAuthority.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) + .naturalPerson( + EntityUpdateParams.NaturalPerson.builder() + .address( + EntityUpdateParams.NaturalPerson.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -27,7 +66,20 @@ internal class EntityUpdateParamsTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) - .trust(EntityUpdateParams.Trust.builder().name("x").build()) + .trust( + EntityUpdateParams.Trust.builder() + .address( + EntityUpdateParams.Trust.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) .build() } @@ -45,11 +97,48 @@ internal class EntityUpdateParamsTest { val params = EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") - .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .corporation( + EntityUpdateParams.Corporation.builder() + .address( + EntityUpdateParams.Corporation.Address.builder() + .city("New York") + .line1("33 Liberty Street") + .state("NY") + .zip("10045") + .line2("Unit 2") + .build() + ) + .name("x") + .build() + ) .governmentAuthority( - EntityUpdateParams.GovernmentAuthority.builder().name("x").build() + EntityUpdateParams.GovernmentAuthority.builder() + .address( + EntityUpdateParams.GovernmentAuthority.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) + .naturalPerson( + EntityUpdateParams.NaturalPerson.builder() + .address( + EntityUpdateParams.NaturalPerson.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() ) - .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -62,17 +151,69 @@ internal class EntityUpdateParamsTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) - .trust(EntityUpdateParams.Trust.builder().name("x").build()) + .trust( + EntityUpdateParams.Trust.builder() + .address( + EntityUpdateParams.Trust.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) .build() val body = params._body() assertThat(body.corporation()) - .contains(EntityUpdateParams.Corporation.builder().name("x").build()) + .contains( + EntityUpdateParams.Corporation.builder() + .address( + EntityUpdateParams.Corporation.Address.builder() + .city("New York") + .line1("33 Liberty Street") + .state("NY") + .zip("10045") + .line2("Unit 2") + .build() + ) + .name("x") + .build() + ) assertThat(body.governmentAuthority()) - .contains(EntityUpdateParams.GovernmentAuthority.builder().name("x").build()) + .contains( + EntityUpdateParams.GovernmentAuthority.builder() + .address( + EntityUpdateParams.GovernmentAuthority.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) assertThat(body.naturalPerson()) - .contains(EntityUpdateParams.NaturalPerson.builder().name("x").build()) + .contains( + EntityUpdateParams.NaturalPerson.builder() + .address( + EntityUpdateParams.NaturalPerson.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) assertThat(body.riskRating()) .contains( EntityUpdateParams.RiskRating.builder() @@ -87,7 +228,21 @@ internal class EntityUpdateParamsTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) - assertThat(body.trust()).contains(EntityUpdateParams.Trust.builder().name("x").build()) + assertThat(body.trust()) + .contains( + EntityUpdateParams.Trust.builder() + .address( + EntityUpdateParams.Trust.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .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 3ba36c120..348b6fdb4 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,11 +483,48 @@ internal class EntityServiceAsyncTest { entityServiceAsync.update( EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") - .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .corporation( + EntityUpdateParams.Corporation.builder() + .address( + EntityUpdateParams.Corporation.Address.builder() + .city("New York") + .line1("33 Liberty Street") + .state("NY") + .zip("10045") + .line2("Unit 2") + .build() + ) + .name("x") + .build() + ) .governmentAuthority( - EntityUpdateParams.GovernmentAuthority.builder().name("x").build() + EntityUpdateParams.GovernmentAuthority.builder() + .address( + EntityUpdateParams.GovernmentAuthority.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) + .naturalPerson( + EntityUpdateParams.NaturalPerson.builder() + .address( + EntityUpdateParams.NaturalPerson.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() ) - .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -500,7 +537,20 @@ internal class EntityServiceAsyncTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) - .trust(EntityUpdateParams.Trust.builder().name("x").build()) + .trust( + EntityUpdateParams.Trust.builder() + .address( + EntityUpdateParams.Trust.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .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 a16120fa3..5e55c05a6 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,11 +481,48 @@ internal class EntityServiceTest { entityService.update( EntityUpdateParams.builder() .entityId("entity_n8y8tnk2p9339ti393yi") - .corporation(EntityUpdateParams.Corporation.builder().name("x").build()) + .corporation( + EntityUpdateParams.Corporation.builder() + .address( + EntityUpdateParams.Corporation.Address.builder() + .city("New York") + .line1("33 Liberty Street") + .state("NY") + .zip("10045") + .line2("Unit 2") + .build() + ) + .name("x") + .build() + ) .governmentAuthority( - EntityUpdateParams.GovernmentAuthority.builder().name("x").build() + EntityUpdateParams.GovernmentAuthority.builder() + .address( + EntityUpdateParams.GovernmentAuthority.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) + .naturalPerson( + EntityUpdateParams.NaturalPerson.builder() + .address( + EntityUpdateParams.NaturalPerson.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() ) - .naturalPerson(EntityUpdateParams.NaturalPerson.builder().name("x").build()) .riskRating( EntityUpdateParams.RiskRating.builder() .ratedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) @@ -498,7 +535,20 @@ internal class EntityServiceTest { .vendor(EntityUpdateParams.ThirdPartyVerification.Vendor.ALLOY) .build() ) - .trust(EntityUpdateParams.Trust.builder().name("x").build()) + .trust( + EntityUpdateParams.Trust.builder() + .address( + EntityUpdateParams.Trust.Address.builder() + .city("x") + .line1("x") + .state("x") + .zip("x") + .line2("x") + .build() + ) + .name("x") + .build() + ) .build() )