diff --git a/.stats.yml b/.stats.yml index e53c0fad3..85960561b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-5dd5f2439cdbbb3bffe2ef733d3d173a10ca3233d15763bad8ccf8f87c10e246.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-8882da77555a843811f51c01d96a8a0f5dd36dc70de46bdf01a1e624807ba3a6.yml diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/AccountNumberListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/AccountNumberListParams.kt index 546322e47..b1ae3b137 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/AccountNumberListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/AccountNumberListParams.kt @@ -9,6 +9,7 @@ import com.increase.api.core.NoAutoDetect import com.increase.api.core.Params import com.increase.api.core.http.Headers import com.increase.api.core.http.QueryParams +import com.increase.api.core.toImmutable import com.increase.api.errors.IncreaseInvalidDataException import java.time.OffsetDateTime import java.time.format.DateTimeFormatter @@ -32,7 +33,6 @@ private constructor( /** Filter Account Numbers to those belonging to the specified Account. */ fun accountId(): Optional = Optional.ofNullable(accountId) - /** The ACH Debit status to retrieve Account Numbers for. */ fun achDebitStatus(): Optional = Optional.ofNullable(achDebitStatus) fun createdAt(): Optional = Optional.ofNullable(createdAt) @@ -50,7 +50,6 @@ private constructor( /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ fun limit(): Optional = Optional.ofNullable(limit) - /** The status to retrieve Account Numbers for. */ fun status(): Optional = Optional.ofNullable(status) fun _additionalHeaders(): Headers = additionalHeaders @@ -62,14 +61,16 @@ private constructor( override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() this.accountId?.let { queryParams.put("account_id", listOf(it.toString())) } - this.achDebitStatus?.let { queryParams.put("ach_debit_status", listOf(it.toString())) } + this.achDebitStatus?.forEachQueryParam { key, values -> + queryParams.put("ach_debit_status.$key", values) + } this.createdAt?.forEachQueryParam { key, values -> queryParams.put("created_at.$key", values) } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } this.idempotencyKey?.let { queryParams.put("idempotency_key", listOf(it.toString())) } this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.status?.let { queryParams.put("status", listOf(it.toString())) } + this.status?.forEachQueryParam { key, values -> queryParams.put("status.$key", values) } queryParams.putAll(additionalQueryParams) return queryParams.build() } @@ -116,12 +117,10 @@ private constructor( /** Filter Account Numbers to those belonging to the specified Account. */ fun accountId(accountId: Optional) = accountId(accountId.orElse(null)) - /** The ACH Debit status to retrieve Account Numbers for. */ fun achDebitStatus(achDebitStatus: AchDebitStatus?) = apply { this.achDebitStatus = achDebitStatus } - /** The ACH Debit status to retrieve Account Numbers for. */ fun achDebitStatus(achDebitStatus: Optional) = achDebitStatus(achDebitStatus.orElse(null)) @@ -168,10 +167,8 @@ private constructor( @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) - /** The status to retrieve Account Numbers for. */ fun status(status: Status?) = apply { this.status = status } - /** The status to retrieve Account Numbers for. */ fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -286,115 +283,237 @@ private constructor( ) } - /** The ACH Debit status to retrieve Account Numbers for. */ - class AchDebitStatus @JsonCreator private constructor(private val value: JsonField) : - Enum { + class AchDebitStatus + private constructor(private val in_: List?, private val additionalProperties: QueryParams) { /** - * 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. + * The ACH Debit status to retrieve Account Numbers for. For GET requests, this should be + * encoded as a comma-delimited string, such as `?in=one,two,three`. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun in_(): Optional> = Optional.ofNullable(in_) - companion object { + fun _additionalProperties(): QueryParams = additionalProperties - /** ACH Debits are allowed. */ - @JvmField val ALLOWED = of("allowed") + @JvmSynthetic + internal fun forEachQueryParam(putParam: (String, List) -> Unit) { + this.in_?.let { putParam("in", listOf(it.joinToString(separator = ","))) } + additionalProperties.keys().forEach { putParam(it, additionalProperties.values(it)) } + } - /** ACH Debits are blocked. */ - @JvmField val BLOCKED = of("blocked") + fun toBuilder() = Builder().from(this) - @JvmStatic fun of(value: String) = AchDebitStatus(JsonField.of(value)) - } + companion object { - /** An enum containing [AchDebitStatus]'s known values. */ - enum class Known { - /** ACH Debits are allowed. */ - ALLOWED, - /** ACH Debits are blocked. */ - BLOCKED, + @JvmStatic fun builder() = Builder() } - /** - * An enum containing [AchDebitStatus]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [AchDebitStatus] 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 { - /** ACH Debits are allowed. */ - ALLOWED, - /** ACH Debits are blocked. */ - BLOCKED, + /** A builder for [AchDebitStatus]. */ + class Builder internal constructor() { + + private var in_: MutableList? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(achDebitStatus: AchDebitStatus) = apply { + in_ = achDebitStatus.in_?.toMutableList() + additionalProperties = achDebitStatus.additionalProperties.toBuilder() + } + + /** + * The ACH Debit status to retrieve Account Numbers for. For GET requests, this should + * be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } + + /** + * The ACH Debit status to retrieve Account Numbers for. For GET requests, this should + * be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: Optional>) = in_(in_.orElse(null)) + /** - * An enum member indicating that [AchDebitStatus] was instantiated with an unknown - * value. + * The ACH Debit status to retrieve Account Numbers for. For GET requests, this should + * be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - _UNKNOWN, + fun addIn(in_: In) = apply { + this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } + } + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + fun build(): AchDebitStatus = + AchDebitStatus(in_?.toImmutable(), additionalProperties.build()) } - /** - * 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) { - ALLOWED -> Value.ALLOWED - BLOCKED -> Value.BLOCKED - else -> Value._UNKNOWN + class In @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 { + + /** ACH Debits are allowed. */ + @JvmField val ALLOWED = of("allowed") + + /** ACH Debits are blocked. */ + @JvmField val BLOCKED = of("blocked") + + @JvmStatic fun of(value: String) = In(JsonField.of(value)) } - /** - * 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) { - ALLOWED -> Known.ALLOWED - BLOCKED -> Known.BLOCKED - else -> throw IncreaseInvalidDataException("Unknown AchDebitStatus: $value") + /** An enum containing [In]'s known values. */ + enum class Known { + /** ACH Debits are allowed. */ + ALLOWED, + /** ACH Debits are blocked. */ + BLOCKED, } - /** - * 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") + /** + * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [In] 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 { + /** ACH Debits are allowed. */ + ALLOWED, + /** ACH Debits are blocked. */ + BLOCKED, + /** An enum member indicating that [In] 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) { + ALLOWED -> Value.ALLOWED + BLOCKED -> Value.BLOCKED + 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) { + ALLOWED -> Known.ALLOWED + BLOCKED -> Known.BLOCKED + else -> throw IncreaseInvalidDataException("Unknown In: $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") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is In && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is AchDebitStatus && value == other.value /* spotless:on */ + return /* spotless:off */ other is AchDebitStatus && in_ == other.in_ && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } + /* spotless:on */ - override fun toString() = value.toString() + override fun hashCode(): Int = hashCode + + override fun toString() = + "AchDebitStatus{in_=$in_, additionalProperties=$additionalProperties}" } class CreatedAt @@ -592,120 +711,244 @@ private constructor( "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" } - /** The status to retrieve Account Numbers for. */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + class Status + private constructor(private val in_: List?, private val additionalProperties: QueryParams) { /** - * 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. + * The status to retrieve Account Numbers for. For GET requests, this should be encoded as a + * comma-delimited string, such as `?in=one,two,three`. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun in_(): Optional> = Optional.ofNullable(in_) - companion object { + fun _additionalProperties(): QueryParams = additionalProperties - /** The account number is active. */ - @JvmField val ACTIVE = of("active") + @JvmSynthetic + internal fun forEachQueryParam(putParam: (String, List) -> Unit) { + this.in_?.let { putParam("in", listOf(it.joinToString(separator = ","))) } + additionalProperties.keys().forEach { putParam(it, additionalProperties.values(it)) } + } - /** The account number is temporarily disabled. */ - @JvmField val DISABLED = of("disabled") + fun toBuilder() = Builder().from(this) - /** The account number is permanently disabled. */ - @JvmField val CANCELED = of("canceled") + companion object { - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + @JvmStatic fun builder() = Builder() } - /** An enum containing [Status]'s known values. */ - enum class Known { - /** The account number is active. */ - ACTIVE, - /** The account number is temporarily disabled. */ - DISABLED, - /** The account number is permanently disabled. */ - CANCELED, - } + /** A builder for [Status]. */ + class Builder internal constructor() { - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** The account number is active. */ - ACTIVE, - /** The account number is temporarily disabled. */ - DISABLED, - /** The account number is permanently disabled. */ - CANCELED, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, + private var in_: MutableList? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(status: Status) = apply { + in_ = status.in_?.toMutableList() + additionalProperties = status.additionalProperties.toBuilder() + } + + /** + * The status to retrieve Account Numbers for. For GET requests, this should be encoded + * as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } + + /** + * The status to retrieve Account Numbers for. For GET requests, this should be encoded + * as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: Optional>) = in_(in_.orElse(null)) + + /** + * The status to retrieve Account Numbers for. For GET requests, this should be encoded + * as a comma-delimited string, such as `?in=one,two,three`. + */ + fun addIn(in_: In) = apply { + this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } + } + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + fun build(): Status = Status(in_?.toImmutable(), additionalProperties.build()) } - /** - * 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) { - ACTIVE -> Value.ACTIVE - DISABLED -> Value.DISABLED - CANCELED -> Value.CANCELED - else -> Value._UNKNOWN + class In @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** The account number is active. */ + @JvmField val ACTIVE = of("active") + + /** The account number is temporarily disabled. */ + @JvmField val DISABLED = of("disabled") + + /** The account number is permanently disabled. */ + @JvmField val CANCELED = of("canceled") + + @JvmStatic fun of(value: String) = In(JsonField.of(value)) } - /** - * 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) { - ACTIVE -> Known.ACTIVE - DISABLED -> Known.DISABLED - CANCELED -> Known.CANCELED - else -> throw IncreaseInvalidDataException("Unknown Status: $value") + /** An enum containing [In]'s known values. */ + enum class Known { + /** The account number is active. */ + ACTIVE, + /** The account number is temporarily disabled. */ + DISABLED, + /** The account number is permanently disabled. */ + CANCELED, } - /** - * 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") + /** + * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [In] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The account number is active. */ + ACTIVE, + /** The account number is temporarily disabled. */ + DISABLED, + /** The account number is permanently disabled. */ + CANCELED, + /** An enum member indicating that [In] 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) { + ACTIVE -> Value.ACTIVE + DISABLED -> Value.DISABLED + CANCELED -> Value.CANCELED + 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) { + ACTIVE -> Known.ACTIVE + DISABLED -> Known.DISABLED + CANCELED -> Known.CANCELED + else -> throw IncreaseInvalidDataException("Unknown In: $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") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is In && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Status && in_ == other.in_ && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = "Status{in_=$in_, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/InboundAchTransferListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/InboundAchTransferListParams.kt index bbacb0192..9ce208446 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/InboundAchTransferListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/InboundAchTransferListParams.kt @@ -9,6 +9,7 @@ import com.increase.api.core.NoAutoDetect import com.increase.api.core.Params import com.increase.api.core.http.Headers import com.increase.api.core.http.QueryParams +import com.increase.api.core.toImmutable import com.increase.api.errors.IncreaseInvalidDataException import java.time.OffsetDateTime import java.time.format.DateTimeFormatter @@ -28,10 +29,10 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Filter Inbound ACH Tranfers to ones belonging to the specified Account. */ + /** Filter Inbound ACH Transfers to ones belonging to the specified Account. */ fun accountId(): Optional = Optional.ofNullable(accountId) - /** Filter Inbound ACH Tranfers to ones belonging to the specified Account Number. */ + /** Filter Inbound ACH Transfers to ones belonging to the specified Account Number. */ fun accountNumberId(): Optional = Optional.ofNullable(accountNumberId) fun createdAt(): Optional = Optional.ofNullable(createdAt) @@ -42,7 +43,6 @@ private constructor( /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ fun limit(): Optional = Optional.ofNullable(limit) - /** Filter Inbound ACH Transfers to those with the specified status. */ fun status(): Optional = Optional.ofNullable(status) fun _additionalHeaders(): Headers = additionalHeaders @@ -60,7 +60,7 @@ private constructor( } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.status?.let { queryParams.put("status", listOf(it.toString())) } + this.status?.forEachQueryParam { key, values -> queryParams.put("status.$key", values) } queryParams.putAll(additionalQueryParams) return queryParams.build() } @@ -99,18 +99,18 @@ private constructor( additionalQueryParams = inboundAchTransferListParams.additionalQueryParams.toBuilder() } - /** Filter Inbound ACH Tranfers to ones belonging to the specified Account. */ + /** Filter Inbound ACH Transfers to ones belonging to the specified Account. */ fun accountId(accountId: String?) = apply { this.accountId = accountId } - /** Filter Inbound ACH Tranfers to ones belonging to the specified Account. */ + /** Filter Inbound ACH Transfers to ones belonging to the specified Account. */ fun accountId(accountId: Optional) = accountId(accountId.orElse(null)) - /** Filter Inbound ACH Tranfers to ones belonging to the specified Account Number. */ + /** Filter Inbound ACH Transfers to ones belonging to the specified Account Number. */ fun accountNumberId(accountNumberId: String?) = apply { this.accountNumberId = accountNumberId } - /** Filter Inbound ACH Tranfers to ones belonging to the specified Account Number. */ + /** Filter Inbound ACH Transfers to ones belonging to the specified Account Number. */ fun accountNumberId(accountNumberId: Optional) = accountNumberId(accountNumberId.orElse(null)) @@ -140,10 +140,8 @@ private constructor( @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) - /** Filter Inbound ACH Transfers to those with the specified status. */ fun status(status: Status?) = apply { this.status = status } - /** Filter Inbound ACH Transfers to those with the specified status. */ fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -452,138 +450,262 @@ private constructor( "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" } - /** Filter Inbound ACH Transfers to those with the specified status. */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + class Status + private constructor(private val in_: List?, private val additionalProperties: QueryParams) { /** - * 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. + * Filter Inbound ACH Transfers to those with the specified status. For GET requests, this + * should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun in_(): Optional> = Optional.ofNullable(in_) + + fun _additionalProperties(): QueryParams = additionalProperties + + @JvmSynthetic + internal fun forEachQueryParam(putParam: (String, List) -> Unit) { + this.in_?.let { putParam("in", listOf(it.joinToString(separator = ","))) } + additionalProperties.keys().forEach { putParam(it, additionalProperties.values(it)) } + } + + fun toBuilder() = Builder().from(this) companion object { - /** - * The Inbound ACH Transfer is awaiting action, will transition automatically if no - * action is taken. - */ - @JvmField val PENDING = of("pending") + @JvmStatic fun builder() = Builder() + } - /** The Inbound ACH Transfer has been declined. */ - @JvmField val DECLINED = of("declined") + /** A builder for [Status]. */ + class Builder internal constructor() { - /** The Inbound ACH Transfer is accepted. */ - @JvmField val ACCEPTED = of("accepted") + private var in_: MutableList? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() - /** The Inbound ACH Transfer has been returned. */ - @JvmField val RETURNED = of("returned") + @JvmSynthetic + internal fun from(status: Status) = apply { + in_ = status.in_?.toMutableList() + additionalProperties = status.additionalProperties.toBuilder() + } - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } + /** + * Filter Inbound ACH Transfers to those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } - /** An enum containing [Status]'s known values. */ - enum class Known { /** - * The Inbound ACH Transfer is awaiting action, will transition automatically if no - * action is taken. + * Filter Inbound ACH Transfers to those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - PENDING, - /** The Inbound ACH Transfer has been declined. */ - DECLINED, - /** The Inbound ACH Transfer is accepted. */ - ACCEPTED, - /** The Inbound ACH Transfer has been returned. */ - RETURNED, - } + fun in_(in_: Optional>) = in_(in_.orElse(null)) - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { /** - * The Inbound ACH Transfer is awaiting action, will transition automatically if no - * action is taken. + * Filter Inbound ACH Transfers to those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - PENDING, - /** The Inbound ACH Transfer has been declined. */ - DECLINED, - /** The Inbound ACH Transfer is accepted. */ - ACCEPTED, - /** The Inbound ACH Transfer has been returned. */ - RETURNED, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, + fun addIn(in_: In) = apply { + this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } + } + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + fun build(): Status = Status(in_?.toImmutable(), additionalProperties.build()) } - /** - * 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) { - PENDING -> Value.PENDING - DECLINED -> Value.DECLINED - ACCEPTED -> Value.ACCEPTED - RETURNED -> Value.RETURNED - else -> Value._UNKNOWN + class In @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** + * The Inbound ACH Transfer is awaiting action, will transition automatically if no + * action is taken. + */ + @JvmField val PENDING = of("pending") + + /** The Inbound ACH Transfer has been declined. */ + @JvmField val DECLINED = of("declined") + + /** The Inbound ACH Transfer is accepted. */ + @JvmField val ACCEPTED = of("accepted") + + /** The Inbound ACH Transfer has been returned. */ + @JvmField val RETURNED = of("returned") + + @JvmStatic fun of(value: String) = In(JsonField.of(value)) } - /** - * 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) { - PENDING -> Known.PENDING - DECLINED -> Known.DECLINED - ACCEPTED -> Known.ACCEPTED - RETURNED -> Known.RETURNED - else -> throw IncreaseInvalidDataException("Unknown Status: $value") + /** An enum containing [In]'s known values. */ + enum class Known { + /** + * The Inbound ACH Transfer is awaiting action, will transition automatically if no + * action is taken. + */ + PENDING, + /** The Inbound ACH Transfer has been declined. */ + DECLINED, + /** The Inbound ACH Transfer is accepted. */ + ACCEPTED, + /** The Inbound ACH Transfer has been returned. */ + RETURNED, } - /** - * 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") + /** + * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [In] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * The Inbound ACH Transfer is awaiting action, will transition automatically if no + * action is taken. + */ + PENDING, + /** The Inbound ACH Transfer has been declined. */ + DECLINED, + /** The Inbound ACH Transfer is accepted. */ + ACCEPTED, + /** The Inbound ACH Transfer has been returned. */ + RETURNED, + /** An enum member indicating that [In] 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) { + PENDING -> Value.PENDING + DECLINED -> Value.DECLINED + ACCEPTED -> Value.ACCEPTED + RETURNED -> Value.RETURNED + 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) { + PENDING -> Known.PENDING + DECLINED -> Known.DECLINED + ACCEPTED -> Known.ACCEPTED + RETURNED -> Known.RETURNED + else -> throw IncreaseInvalidDataException("Unknown In: $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") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is In && value == other.value /* spotless:on */ } + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Status && in_ == other.in_ && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = "Status{in_=$in_, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/InboundWireTransferListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/InboundWireTransferListParams.kt index dc506afd2..05a1fa9f0 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/InboundWireTransferListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/InboundWireTransferListParams.kt @@ -9,6 +9,7 @@ import com.increase.api.core.NoAutoDetect import com.increase.api.core.Params import com.increase.api.core.http.Headers import com.increase.api.core.http.QueryParams +import com.increase.api.core.toImmutable import com.increase.api.errors.IncreaseInvalidDataException import java.time.OffsetDateTime import java.time.format.DateTimeFormatter @@ -28,10 +29,10 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Filter Inbound Wire Tranfers to ones belonging to the specified Account. */ + /** Filter Inbound Wire Transfers to ones belonging to the specified Account. */ fun accountId(): Optional = Optional.ofNullable(accountId) - /** Filter Inbound Wire Tranfers to ones belonging to the specified Account Number. */ + /** Filter Inbound Wire Transfers to ones belonging to the specified Account Number. */ fun accountNumberId(): Optional = Optional.ofNullable(accountNumberId) fun createdAt(): Optional = Optional.ofNullable(createdAt) @@ -42,7 +43,6 @@ private constructor( /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ fun limit(): Optional = Optional.ofNullable(limit) - /** Filter Inbound Wire Transfers to those with the specified status. */ fun status(): Optional = Optional.ofNullable(status) fun _additionalHeaders(): Headers = additionalHeaders @@ -60,7 +60,7 @@ private constructor( } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.status?.let { queryParams.put("status", listOf(it.toString())) } + this.status?.forEachQueryParam { key, values -> queryParams.put("status.$key", values) } queryParams.putAll(additionalQueryParams) return queryParams.build() } @@ -99,18 +99,18 @@ private constructor( additionalQueryParams = inboundWireTransferListParams.additionalQueryParams.toBuilder() } - /** Filter Inbound Wire Tranfers to ones belonging to the specified Account. */ + /** Filter Inbound Wire Transfers to ones belonging to the specified Account. */ fun accountId(accountId: String?) = apply { this.accountId = accountId } - /** Filter Inbound Wire Tranfers to ones belonging to the specified Account. */ + /** Filter Inbound Wire Transfers to ones belonging to the specified Account. */ fun accountId(accountId: Optional) = accountId(accountId.orElse(null)) - /** Filter Inbound Wire Tranfers to ones belonging to the specified Account Number. */ + /** Filter Inbound Wire Transfers to ones belonging to the specified Account Number. */ fun accountNumberId(accountNumberId: String?) = apply { this.accountNumberId = accountNumberId } - /** Filter Inbound Wire Tranfers to ones belonging to the specified Account Number. */ + /** Filter Inbound Wire Transfers to ones belonging to the specified Account Number. */ fun accountNumberId(accountNumberId: Optional) = accountNumberId(accountNumberId.orElse(null)) @@ -140,10 +140,8 @@ private constructor( @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) - /** Filter Inbound Wire Transfers to those with the specified status. */ fun status(status: Status?) = apply { this.status = status } - /** Filter Inbound Wire Transfers to those with the specified status. */ fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -452,138 +450,262 @@ private constructor( "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" } - /** Filter Inbound Wire Transfers to those with the specified status. */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + class Status + private constructor(private val in_: List?, private val additionalProperties: QueryParams) { /** - * 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. + * Filter Inbound Wire Transfers to those with the specified status. For GET requests, this + * should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun in_(): Optional> = Optional.ofNullable(in_) + + fun _additionalProperties(): QueryParams = additionalProperties + + @JvmSynthetic + internal fun forEachQueryParam(putParam: (String, List) -> Unit) { + this.in_?.let { putParam("in", listOf(it.joinToString(separator = ","))) } + additionalProperties.keys().forEach { putParam(it, additionalProperties.values(it)) } + } + + fun toBuilder() = Builder().from(this) companion object { - /** - * The Inbound Wire Transfer is awaiting action, will transition automatically if no - * action is taken. - */ - @JvmField val PENDING = of("pending") + @JvmStatic fun builder() = Builder() + } - /** The Inbound Wire Transfer is accepted. */ - @JvmField val ACCEPTED = of("accepted") + /** A builder for [Status]. */ + class Builder internal constructor() { - /** The Inbound Wire Transfer was declined. */ - @JvmField val DECLINED = of("declined") + private var in_: MutableList? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() - /** The Inbound Wire Transfer was reversed. */ - @JvmField val REVERSED = of("reversed") + @JvmSynthetic + internal fun from(status: Status) = apply { + in_ = status.in_?.toMutableList() + additionalProperties = status.additionalProperties.toBuilder() + } - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } + /** + * Filter Inbound Wire Transfers to those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } - /** An enum containing [Status]'s known values. */ - enum class Known { /** - * The Inbound Wire Transfer is awaiting action, will transition automatically if no - * action is taken. + * Filter Inbound Wire Transfers to those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - PENDING, - /** The Inbound Wire Transfer is accepted. */ - ACCEPTED, - /** The Inbound Wire Transfer was declined. */ - DECLINED, - /** The Inbound Wire Transfer was reversed. */ - REVERSED, - } + fun in_(in_: Optional>) = in_(in_.orElse(null)) - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { /** - * The Inbound Wire Transfer is awaiting action, will transition automatically if no - * action is taken. + * Filter Inbound Wire Transfers to those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - PENDING, - /** The Inbound Wire Transfer is accepted. */ - ACCEPTED, - /** The Inbound Wire Transfer was declined. */ - DECLINED, - /** The Inbound Wire Transfer was reversed. */ - REVERSED, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, + fun addIn(in_: In) = apply { + this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } + } + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + fun build(): Status = Status(in_?.toImmutable(), additionalProperties.build()) } - /** - * 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) { - PENDING -> Value.PENDING - ACCEPTED -> Value.ACCEPTED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - else -> Value._UNKNOWN + class In @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** + * The Inbound Wire Transfer is awaiting action, will transition automatically if no + * action is taken. + */ + @JvmField val PENDING = of("pending") + + /** The Inbound Wire Transfer is accepted. */ + @JvmField val ACCEPTED = of("accepted") + + /** The Inbound Wire Transfer was declined. */ + @JvmField val DECLINED = of("declined") + + /** The Inbound Wire Transfer was reversed. */ + @JvmField val REVERSED = of("reversed") + + @JvmStatic fun of(value: String) = In(JsonField.of(value)) } - /** - * 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) { - PENDING -> Known.PENDING - ACCEPTED -> Known.ACCEPTED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - else -> throw IncreaseInvalidDataException("Unknown Status: $value") + /** An enum containing [In]'s known values. */ + enum class Known { + /** + * The Inbound Wire Transfer is awaiting action, will transition automatically if no + * action is taken. + */ + PENDING, + /** The Inbound Wire Transfer is accepted. */ + ACCEPTED, + /** The Inbound Wire Transfer was declined. */ + DECLINED, + /** The Inbound Wire Transfer was reversed. */ + REVERSED, } - /** - * 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") + /** + * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [In] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** + * The Inbound Wire Transfer is awaiting action, will transition automatically if no + * action is taken. + */ + PENDING, + /** The Inbound Wire Transfer is accepted. */ + ACCEPTED, + /** The Inbound Wire Transfer was declined. */ + DECLINED, + /** The Inbound Wire Transfer was reversed. */ + REVERSED, + /** An enum member indicating that [In] 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) { + PENDING -> Value.PENDING + ACCEPTED -> Value.ACCEPTED + DECLINED -> Value.DECLINED + REVERSED -> Value.REVERSED + 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) { + PENDING -> Known.PENDING + ACCEPTED -> Known.ACCEPTED + DECLINED -> Known.DECLINED + REVERSED -> Known.REVERSED + else -> throw IncreaseInvalidDataException("Unknown In: $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") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is In && value == other.value /* spotless:on */ } + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Status && in_ == other.in_ && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = "Status{in_=$in_, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/WireDrawdownRequestListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/WireDrawdownRequestListParams.kt index 31e5991c1..80b0d48f1 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/WireDrawdownRequestListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/WireDrawdownRequestListParams.kt @@ -9,6 +9,7 @@ import com.increase.api.core.NoAutoDetect import com.increase.api.core.Params import com.increase.api.core.http.Headers import com.increase.api.core.http.QueryParams +import com.increase.api.core.toImmutable import com.increase.api.errors.IncreaseInvalidDataException import java.util.Objects import java.util.Optional @@ -37,7 +38,6 @@ private constructor( /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ fun limit(): Optional = Optional.ofNullable(limit) - /** Filter Wire Drawdown Requests for those with the specified status. */ fun status(): Optional = Optional.ofNullable(status) fun _additionalHeaders(): Headers = additionalHeaders @@ -51,7 +51,7 @@ private constructor( this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } this.idempotencyKey?.let { queryParams.put("idempotency_key", listOf(it.toString())) } this.limit?.let { queryParams.put("limit", listOf(it.toString())) } - this.status?.let { queryParams.put("status", listOf(it.toString())) } + this.status?.forEachQueryParam { key, values -> queryParams.put("status.$key", values) } queryParams.putAll(additionalQueryParams) return queryParams.build() } @@ -125,10 +125,8 @@ private constructor( @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228 fun limit(limit: Optional) = limit(limit.orElse(null) as Long?) - /** Filter Wire Drawdown Requests for those with the specified status. */ fun status(status: Status?) = apply { this.status = status } - /** Filter Wire Drawdown Requests for those with the specified status. */ fun status(status: Optional) = status(status.orElse(null)) fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -240,129 +238,259 @@ private constructor( ) } - /** Filter Wire Drawdown Requests for those with the specified status. */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { + class Status + private constructor(private val in_: List?, private val additionalProperties: QueryParams) { /** - * 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. + * Filter Wire Drawdown Requests for those with the specified status. For GET requests, this + * should be encoded as a comma-delimited string, such as `?in=one,two,three`. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun in_(): Optional> = Optional.ofNullable(in_) + + fun _additionalProperties(): QueryParams = additionalProperties + + @JvmSynthetic + internal fun forEachQueryParam(putParam: (String, List) -> Unit) { + this.in_?.let { putParam("in", listOf(it.joinToString(separator = ","))) } + additionalProperties.keys().forEach { putParam(it, additionalProperties.values(it)) } + } + + fun toBuilder() = Builder().from(this) companion object { - /** The drawdown request is queued to be submitted to Fedwire. */ - @JvmField val PENDING_SUBMISSION = of("pending_submission") + @JvmStatic fun builder() = Builder() + } - /** The drawdown request has been sent and the recipient should respond in some way. */ - @JvmField val PENDING_RESPONSE = of("pending_response") + /** A builder for [Status]. */ + class Builder internal constructor() { - /** The drawdown request has been fulfilled by the recipient. */ - @JvmField val FULFILLED = of("fulfilled") + private var in_: MutableList? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() - /** The drawdown request has been refused by the recipient. */ - @JvmField val REFUSED = of("refused") + @JvmSynthetic + internal fun from(status: Status) = apply { + in_ = status.in_?.toMutableList() + additionalProperties = status.additionalProperties.toBuilder() + } - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } + /** + * Filter Wire Drawdown Requests for those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } + + /** + * Filter Wire Drawdown Requests for those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun in_(in_: Optional>) = in_(in_.orElse(null)) + + /** + * Filter Wire Drawdown Requests for those with the specified status. For GET requests, + * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. + */ + fun addIn(in_: In) = apply { + this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } + } - /** An enum containing [Status]'s known values. */ - enum class Known { - /** The drawdown request is queued to be submitted to Fedwire. */ - PENDING_SUBMISSION, - /** The drawdown request has been sent and the recipient should respond in some way. */ - PENDING_RESPONSE, - /** The drawdown request has been fulfilled by the recipient. */ - FULFILLED, - /** The drawdown request has been refused by the recipient. */ - REFUSED, - } + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** The drawdown request is queued to be submitted to Fedwire. */ - PENDING_SUBMISSION, - /** The drawdown request has been sent and the recipient should respond in some way. */ - PENDING_RESPONSE, - /** The drawdown request has been fulfilled by the recipient. */ - FULFILLED, - /** The drawdown request has been refused by the recipient. */ - REFUSED, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + fun build(): Status = Status(in_?.toImmutable(), additionalProperties.build()) } - /** - * 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) { - PENDING_SUBMISSION -> Value.PENDING_SUBMISSION - PENDING_RESPONSE -> Value.PENDING_RESPONSE - FULFILLED -> Value.FULFILLED - REFUSED -> Value.REFUSED - else -> Value._UNKNOWN + class In @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** The drawdown request is queued to be submitted to Fedwire. */ + @JvmField val PENDING_SUBMISSION = of("pending_submission") + + /** + * The drawdown request has been sent and the recipient should respond in some way. + */ + @JvmField val PENDING_RESPONSE = of("pending_response") + + /** The drawdown request has been fulfilled by the recipient. */ + @JvmField val FULFILLED = of("fulfilled") + + /** The drawdown request has been refused by the recipient. */ + @JvmField val REFUSED = of("refused") + + @JvmStatic fun of(value: String) = In(JsonField.of(value)) } - /** - * 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) { - PENDING_SUBMISSION -> Known.PENDING_SUBMISSION - PENDING_RESPONSE -> Known.PENDING_RESPONSE - FULFILLED -> Known.FULFILLED - REFUSED -> Known.REFUSED - else -> throw IncreaseInvalidDataException("Unknown Status: $value") + /** An enum containing [In]'s known values. */ + enum class Known { + /** The drawdown request is queued to be submitted to Fedwire. */ + PENDING_SUBMISSION, + /** + * The drawdown request has been sent and the recipient should respond in some way. + */ + PENDING_RESPONSE, + /** The drawdown request has been fulfilled by the recipient. */ + FULFILLED, + /** The drawdown request has been refused by the recipient. */ + REFUSED, } - /** - * 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") + /** + * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [In] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The drawdown request is queued to be submitted to Fedwire. */ + PENDING_SUBMISSION, + /** + * The drawdown request has been sent and the recipient should respond in some way. + */ + PENDING_RESPONSE, + /** The drawdown request has been fulfilled by the recipient. */ + FULFILLED, + /** The drawdown request has been refused by the recipient. */ + REFUSED, + /** An enum member indicating that [In] 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) { + PENDING_SUBMISSION -> Value.PENDING_SUBMISSION + PENDING_RESPONSE -> Value.PENDING_RESPONSE + FULFILLED -> Value.FULFILLED + REFUSED -> Value.REFUSED + 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) { + PENDING_SUBMISSION -> Known.PENDING_SUBMISSION + PENDING_RESPONSE -> Known.PENDING_RESPONSE + FULFILLED -> Known.FULFILLED + REFUSED -> Known.REFUSED + else -> throw IncreaseInvalidDataException("Unknown In: $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") + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is In && value == other.value /* spotless:on */ + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Status && value == other.value /* spotless:on */ + return /* spotless:off */ other is Status && in_ == other.in_ && additionalProperties == other.additionalProperties /* spotless:on */ } - override fun hashCode() = value.hashCode() + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode - override fun toString() = value.toString() + override fun toString() = "Status{in_=$in_, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/AccountNumberListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/AccountNumberListParamsTest.kt index 7c7c4a1c1..4cac976d9 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/AccountNumberListParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/AccountNumberListParamsTest.kt @@ -13,7 +13,11 @@ class AccountNumberListParamsTest { fun create() { AccountNumberListParams.builder() .accountId("account_id") - .achDebitStatus(AccountNumberListParams.AchDebitStatus.ALLOWED) + .achDebitStatus( + AccountNumberListParams.AchDebitStatus.builder() + .addIn(AccountNumberListParams.AchDebitStatus.In.ALLOWED) + .build() + ) .createdAt( AccountNumberListParams.CreatedAt.builder() .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -25,7 +29,11 @@ class AccountNumberListParamsTest { .cursor("cursor") .idempotencyKey("x") .limit(1L) - .status(AccountNumberListParams.Status.ACTIVE) + .status( + AccountNumberListParams.Status.builder() + .addIn(AccountNumberListParams.Status.In.ACTIVE) + .build() + ) .build() } @@ -34,7 +42,11 @@ class AccountNumberListParamsTest { val params = AccountNumberListParams.builder() .accountId("account_id") - .achDebitStatus(AccountNumberListParams.AchDebitStatus.ALLOWED) + .achDebitStatus( + AccountNumberListParams.AchDebitStatus.builder() + .addIn(AccountNumberListParams.AchDebitStatus.In.ALLOWED) + .build() + ) .createdAt( AccountNumberListParams.CreatedAt.builder() .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -46,11 +58,18 @@ class AccountNumberListParamsTest { .cursor("cursor") .idempotencyKey("x") .limit(1L) - .status(AccountNumberListParams.Status.ACTIVE) + .status( + AccountNumberListParams.Status.builder() + .addIn(AccountNumberListParams.Status.In.ACTIVE) + .build() + ) .build() val expected = QueryParams.builder() expected.put("account_id", "account_id") - expected.put("ach_debit_status", AccountNumberListParams.AchDebitStatus.ALLOWED.toString()) + AccountNumberListParams.AchDebitStatus.builder() + .addIn(AccountNumberListParams.AchDebitStatus.In.ALLOWED) + .build() + .forEachQueryParam { key, values -> expected.put("ach_debit_status.$key", values) } AccountNumberListParams.CreatedAt.builder() .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -61,7 +80,10 @@ class AccountNumberListParamsTest { expected.put("cursor", "cursor") expected.put("idempotency_key", "x") expected.put("limit", "1") - expected.put("status", AccountNumberListParams.Status.ACTIVE.toString()) + AccountNumberListParams.Status.builder() + .addIn(AccountNumberListParams.Status.In.ACTIVE) + .build() + .forEachQueryParam { key, values -> expected.put("status.$key", values) } assertThat(params._queryParams()).isEqualTo(expected.build()) } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/InboundAchTransferListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/InboundAchTransferListParamsTest.kt index b79480000..4739506d4 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/InboundAchTransferListParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/InboundAchTransferListParamsTest.kt @@ -24,7 +24,11 @@ class InboundAchTransferListParamsTest { ) .cursor("cursor") .limit(1L) - .status(InboundAchTransferListParams.Status.PENDING) + .status( + InboundAchTransferListParams.Status.builder() + .addIn(InboundAchTransferListParams.Status.In.PENDING) + .build() + ) .build() } @@ -44,7 +48,11 @@ class InboundAchTransferListParamsTest { ) .cursor("cursor") .limit(1L) - .status(InboundAchTransferListParams.Status.PENDING) + .status( + InboundAchTransferListParams.Status.builder() + .addIn(InboundAchTransferListParams.Status.In.PENDING) + .build() + ) .build() val expected = QueryParams.builder() expected.put("account_id", "account_id") @@ -58,7 +66,10 @@ class InboundAchTransferListParamsTest { .forEachQueryParam { key, values -> expected.put("created_at.$key", values) } expected.put("cursor", "cursor") expected.put("limit", "1") - expected.put("status", InboundAchTransferListParams.Status.PENDING.toString()) + InboundAchTransferListParams.Status.builder() + .addIn(InboundAchTransferListParams.Status.In.PENDING) + .build() + .forEachQueryParam { key, values -> expected.put("status.$key", values) } assertThat(params._queryParams()).isEqualTo(expected.build()) } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/InboundWireTransferListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/InboundWireTransferListParamsTest.kt index 8a3ae3fdf..baa4f95f1 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/InboundWireTransferListParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/InboundWireTransferListParamsTest.kt @@ -24,7 +24,11 @@ class InboundWireTransferListParamsTest { ) .cursor("cursor") .limit(1L) - .status(InboundWireTransferListParams.Status.PENDING) + .status( + InboundWireTransferListParams.Status.builder() + .addIn(InboundWireTransferListParams.Status.In.PENDING) + .build() + ) .build() } @@ -44,7 +48,11 @@ class InboundWireTransferListParamsTest { ) .cursor("cursor") .limit(1L) - .status(InboundWireTransferListParams.Status.PENDING) + .status( + InboundWireTransferListParams.Status.builder() + .addIn(InboundWireTransferListParams.Status.In.PENDING) + .build() + ) .build() val expected = QueryParams.builder() expected.put("account_id", "account_id") @@ -58,7 +66,10 @@ class InboundWireTransferListParamsTest { .forEachQueryParam { key, values -> expected.put("created_at.$key", values) } expected.put("cursor", "cursor") expected.put("limit", "1") - expected.put("status", InboundWireTransferListParams.Status.PENDING.toString()) + InboundWireTransferListParams.Status.builder() + .addIn(InboundWireTransferListParams.Status.In.PENDING) + .build() + .forEachQueryParam { key, values -> expected.put("status.$key", values) } assertThat(params._queryParams()).isEqualTo(expected.build()) } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/WireDrawdownRequestListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/WireDrawdownRequestListParamsTest.kt index 296160b82..14a02e949 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/WireDrawdownRequestListParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/WireDrawdownRequestListParamsTest.kt @@ -14,7 +14,11 @@ class WireDrawdownRequestListParamsTest { .cursor("cursor") .idempotencyKey("x") .limit(1L) - .status(WireDrawdownRequestListParams.Status.PENDING_SUBMISSION) + .status( + WireDrawdownRequestListParams.Status.builder() + .addIn(WireDrawdownRequestListParams.Status.In.PENDING_SUBMISSION) + .build() + ) .build() } @@ -25,13 +29,20 @@ class WireDrawdownRequestListParamsTest { .cursor("cursor") .idempotencyKey("x") .limit(1L) - .status(WireDrawdownRequestListParams.Status.PENDING_SUBMISSION) + .status( + WireDrawdownRequestListParams.Status.builder() + .addIn(WireDrawdownRequestListParams.Status.In.PENDING_SUBMISSION) + .build() + ) .build() val expected = QueryParams.builder() expected.put("cursor", "cursor") expected.put("idempotency_key", "x") expected.put("limit", "1") - expected.put("status", WireDrawdownRequestListParams.Status.PENDING_SUBMISSION.toString()) + WireDrawdownRequestListParams.Status.builder() + .addIn(WireDrawdownRequestListParams.Status.In.PENDING_SUBMISSION) + .build() + .forEachQueryParam { key, values -> expected.put("status.$key", values) } assertThat(params._queryParams()).isEqualTo(expected.build()) }