From 6e7e8a1a88a3734259ee14a5d8c66ba0a70da2f3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:56:20 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../programs/ProgramCreateParams.kt | 232 +++++++++++++++++- .../programs/ProgramCreateParamsTest.kt | 3 + .../simulations/ProgramServiceAsyncTest.kt | 1 + .../simulations/ProgramServiceTest.kt | 1 + 5 files changed, 235 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 083e8155e..076aae75a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 202 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-f0b14ed0b6857930b2bbb80a8a0580dff2aad5510240f608ea9385a8b1d1b66b.yml -openapi_spec_hash: ea869bb98167424f60f8ef006da70945 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-c9d527ceb849bd9a01edc968016381f25fcc375a1409eb113d7e876ae0f2f529.yml +openapi_spec_hash: c7820089282fc6db267d08eaa465075f config_hash: a185e9a72778cc4658ea73fb3a7f1354 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParams.kt index 5555c6c6a..87148e4ac 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParams.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.increase.api.core.Enum import com.increase.api.core.ExcludeMissing import com.increase.api.core.JsonField import com.increase.api.core.JsonMissing @@ -18,6 +19,7 @@ import com.increase.api.errors.IncreaseInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** * Simulates a [Program](#programs) being created in your group. By default, your group has one @@ -39,6 +41,14 @@ private constructor( */ fun name(): String = body.name() + /** + * The bank for the program's accounts, defaults to First Internet Bank. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun bank(): Optional = body.bank() + /** * The identifier of the Account the Program should be added to is for. * @@ -54,6 +64,13 @@ private constructor( */ fun _name(): JsonField = body._name() + /** + * Returns the raw JSON value of [bank]. + * + * Unlike [bank], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _bank(): JsonField = body._bank() + /** * Returns the raw JSON value of [reserveAccountId]. * @@ -103,6 +120,7 @@ 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: * - [name] + * - [bank] * - [reserveAccountId] */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -118,6 +136,17 @@ private constructor( */ fun name(name: JsonField) = apply { body.name(name) } + /** The bank for the program's accounts, defaults to First Internet Bank. */ + fun bank(bank: Bank) = apply { body.bank(bank) } + + /** + * Sets [Builder.bank] to an arbitrary JSON value. + * + * You should usually call [Builder.bank] with a well-typed [Bank] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun bank(bank: JsonField) = apply { body.bank(bank) } + /** The identifier of the Account the Program should be added to is for. */ fun reserveAccountId(reserveAccountId: String) = apply { body.reserveAccountId(reserveAccountId) @@ -280,6 +309,7 @@ private constructor( class Body private constructor( private val name: JsonField, + private val bank: JsonField, private val reserveAccountId: JsonField, private val additionalProperties: MutableMap, ) { @@ -287,10 +317,11 @@ private constructor( @JsonCreator private constructor( @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("bank") @ExcludeMissing bank: JsonField = JsonMissing.of(), @JsonProperty("reserve_account_id") @ExcludeMissing reserveAccountId: JsonField = JsonMissing.of(), - ) : this(name, reserveAccountId, mutableMapOf()) + ) : this(name, bank, reserveAccountId, mutableMapOf()) /** * The name of the program being added. @@ -300,6 +331,14 @@ private constructor( */ fun name(): String = name.getRequired("name") + /** + * The bank for the program's accounts, defaults to First Internet Bank. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun bank(): Optional = bank.getOptional("bank") + /** * The identifier of the Account the Program should be added to is for. * @@ -316,6 +355,13 @@ private constructor( */ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + /** + * Returns the raw JSON value of [bank]. + * + * Unlike [bank], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("bank") @ExcludeMissing fun _bank(): JsonField = bank + /** * Returns the raw JSON value of [reserveAccountId]. * @@ -355,12 +401,14 @@ private constructor( class Builder internal constructor() { private var name: JsonField? = null + private var bank: JsonField = JsonMissing.of() private var reserveAccountId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { name = body.name + bank = body.bank reserveAccountId = body.reserveAccountId additionalProperties = body.additionalProperties.toMutableMap() } @@ -377,6 +425,18 @@ private constructor( */ fun name(name: JsonField) = apply { this.name = name } + /** The bank for the program's accounts, defaults to First Internet Bank. */ + fun bank(bank: Bank) = bank(JsonField.of(bank)) + + /** + * Sets [Builder.bank] to an arbitrary JSON value. + * + * You should usually call [Builder.bank] with a well-typed [Bank] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun bank(bank: JsonField) = apply { this.bank = bank } + /** The identifier of the Account the Program should be added to is for. */ fun reserveAccountId(reserveAccountId: String) = reserveAccountId(JsonField.of(reserveAccountId)) @@ -426,6 +486,7 @@ private constructor( fun build(): Body = Body( checkRequired("name", name), + bank, reserveAccountId, additionalProperties.toMutableMap(), ) @@ -439,6 +500,7 @@ private constructor( } name() + bank().ifPresent { it.validate() } reserveAccountId() validated = true } @@ -460,6 +522,7 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (name.asKnown().isPresent) 1 else 0) + + (bank.asKnown().getOrNull()?.validity() ?: 0) + (if (reserveAccountId.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { @@ -467,17 +530,178 @@ private constructor( return true } - return /* spotless:off */ other is Body && name == other.name && reserveAccountId == other.reserveAccountId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && name == other.name && bank == other.bank && reserveAccountId == other.reserveAccountId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(name, reserveAccountId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(name, bank, reserveAccountId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{name=$name, reserveAccountId=$reserveAccountId, additionalProperties=$additionalProperties}" + "Body{name=$name, bank=$bank, reserveAccountId=$reserveAccountId, additionalProperties=$additionalProperties}" + } + + /** The bank for the program's accounts, defaults to First Internet Bank. */ + class Bank @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** Blue Ridge Bank, N.A. */ + @JvmField val BLUE_RIDGE_BANK = of("blue_ridge_bank") + + /** Core Bank */ + @JvmField val CORE_BANK = of("core_bank") + + /** First Internet Bank of Indiana */ + @JvmField val FIRST_INTERNET_BANK = of("first_internet_bank") + + /** Global Innovations Bank */ + @JvmField val GLOBAL_INNOVATIONS_BANK = of("global_innovations_bank") + + /** Grasshopper Bank */ + @JvmField val GRASSHOPPER_BANK = of("grasshopper_bank") + + @JvmStatic fun of(value: String) = Bank(JsonField.of(value)) + } + + /** An enum containing [Bank]'s known values. */ + enum class Known { + /** Blue Ridge Bank, N.A. */ + BLUE_RIDGE_BANK, + /** Core Bank */ + CORE_BANK, + /** First Internet Bank of Indiana */ + FIRST_INTERNET_BANK, + /** Global Innovations Bank */ + GLOBAL_INNOVATIONS_BANK, + /** Grasshopper Bank */ + GRASSHOPPER_BANK, + } + + /** + * An enum containing [Bank]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Bank] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Blue Ridge Bank, N.A. */ + BLUE_RIDGE_BANK, + /** Core Bank */ + CORE_BANK, + /** First Internet Bank of Indiana */ + FIRST_INTERNET_BANK, + /** Global Innovations Bank */ + GLOBAL_INNOVATIONS_BANK, + /** Grasshopper Bank */ + GRASSHOPPER_BANK, + /** An enum member indicating that [Bank] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + BLUE_RIDGE_BANK -> Value.BLUE_RIDGE_BANK + CORE_BANK -> Value.CORE_BANK + FIRST_INTERNET_BANK -> Value.FIRST_INTERNET_BANK + GLOBAL_INNOVATIONS_BANK -> Value.GLOBAL_INNOVATIONS_BANK + GRASSHOPPER_BANK -> Value.GRASSHOPPER_BANK + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + BLUE_RIDGE_BANK -> Known.BLUE_RIDGE_BANK + CORE_BANK -> Known.CORE_BANK + FIRST_INTERNET_BANK -> Known.FIRST_INTERNET_BANK + GLOBAL_INNOVATIONS_BANK -> Known.GLOBAL_INNOVATIONS_BANK + GRASSHOPPER_BANK -> Known.GRASSHOPPER_BANK + else -> throw IncreaseInvalidDataException("Unknown Bank: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Bank = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Bank && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParamsTest.kt index d9a1a6997..48cf2ec97 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/programs/ProgramCreateParamsTest.kt @@ -11,6 +11,7 @@ internal class ProgramCreateParamsTest { fun create() { ProgramCreateParams.builder() .name("For Benefit Of") + .bank(ProgramCreateParams.Bank.BLUE_RIDGE_BANK) .reserveAccountId("reserve_account_id") .build() } @@ -20,12 +21,14 @@ internal class ProgramCreateParamsTest { val params = ProgramCreateParams.builder() .name("For Benefit Of") + .bank(ProgramCreateParams.Bank.BLUE_RIDGE_BANK) .reserveAccountId("reserve_account_id") .build() val body = params._body() assertThat(body.name()).isEqualTo("For Benefit Of") + assertThat(body.bank()).contains(ProgramCreateParams.Bank.BLUE_RIDGE_BANK) assertThat(body.reserveAccountId()).contains("reserve_account_id") } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/ProgramServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/ProgramServiceAsyncTest.kt index b860c13af..f0d8a967a 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/ProgramServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/ProgramServiceAsyncTest.kt @@ -24,6 +24,7 @@ internal class ProgramServiceAsyncTest { programServiceAsync.create( ProgramCreateParams.builder() .name("For Benefit Of") + .bank(ProgramCreateParams.Bank.BLUE_RIDGE_BANK) .reserveAccountId("reserve_account_id") .build() ) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/ProgramServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/ProgramServiceTest.kt index 2ecce6510..47a2150ff 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/ProgramServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/ProgramServiceTest.kt @@ -24,6 +24,7 @@ internal class ProgramServiceTest { programService.create( ProgramCreateParams.builder() .name("For Benefit Of") + .bank(ProgramCreateParams.Bank.BLUE_RIDGE_BANK) .reserveAccountId("reserve_account_id") .build() ) From 685966e0c0d5fc7e07390941a981fa8751020c5c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 13:56:45 +0000 Subject: [PATCH 2/2] release: 0.261.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1e9a53acd..a0e3f4c85 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.260.0" + ".": "0.261.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 20c3b17c7..b4f81c6c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.261.0 (2025-07-11) + +Full Changelog: [v0.260.0...v0.261.0](https://github.com/Increase/increase-java/compare/v0.260.0...v0.261.0) + +### Features + +* **api:** api update ([6e7e8a1](https://github.com/Increase/increase-java/commit/6e7e8a1a88a3734259ee14a5d8c66ba0a70da2f3)) + ## 0.260.0 (2025-07-10) Full Changelog: [v0.259.0...v0.260.0](https://github.com/Increase/increase-java/compare/v0.259.0...v0.260.0) diff --git a/README.md b/README.md index d5c2cfa68..bb3a91ed1 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.260.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.260.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.260.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.261.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.261.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.261.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.260.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.261.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.260.0") +implementation("com.increase.api:increase-java:0.261.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.260.0") com.increase.api increase-java - 0.260.0 + 0.261.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 8b71fb90c..8b486a042 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.260.0" // x-release-please-version + version = "0.261.0" // x-release-please-version } subprojects {