From 33d199d4111e60cd48a390263194841c00d540e7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:24:27 +0000 Subject: [PATCH 1/3] feat(api): api update --- .stats.yml | 2 +- .../api/models/inboundmailitems/InboundMailItem.kt | 14 +++++--------- .../models/inboundmailitems/InboundMailItemTest.kt | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6f61c3b1a..42d309019 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 236 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-47752267c48d299a01c906499bb7d584228ea8801b7d83e34ae4100d5dec3434.yml -openapi_spec_hash: 9ea8bc6dc383de626d3fa15c823227ae +openapi_spec_hash: ae1e2ef832ba2b284a54b8c9f9ddacdc config_hash: 026e2baa580c7f5f2447c24332081ba8 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/inboundmailitems/InboundMailItem.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/inboundmailitems/InboundMailItem.kt index 540c71a2a..7826ee029 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/inboundmailitems/InboundMailItem.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/inboundmailitems/InboundMailItem.kt @@ -110,10 +110,10 @@ private constructor( /** * The identifier for the Lockbox Address that received this mail item. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun lockboxAddressId(): Optional = lockboxAddressId.getOptional("lockbox_address_id") + fun lockboxAddressId(): String = lockboxAddressId.getRequired("lockbox_address_id") /** * The identifier for the Lockbox Recipient that received this mail item. For mail items that @@ -369,12 +369,8 @@ private constructor( fun fileId(fileId: JsonField) = apply { this.fileId = fileId } /** The identifier for the Lockbox Address that received this mail item. */ - fun lockboxAddressId(lockboxAddressId: String?) = - lockboxAddressId(JsonField.ofNullable(lockboxAddressId)) - - /** Alias for calling [Builder.lockboxAddressId] with `lockboxAddressId.orElse(null)`. */ - fun lockboxAddressId(lockboxAddressId: Optional) = - lockboxAddressId(lockboxAddressId.getOrNull()) + fun lockboxAddressId(lockboxAddressId: String) = + lockboxAddressId(JsonField.of(lockboxAddressId)) /** * Sets [Builder.lockboxAddressId] to an arbitrary JSON value. diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/inboundmailitems/InboundMailItemTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/inboundmailitems/InboundMailItemTest.kt index 62c272456..222b749c6 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/inboundmailitems/InboundMailItemTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/inboundmailitems/InboundMailItemTest.kt @@ -65,7 +65,7 @@ internal class InboundMailItemTest { .isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z")) assertThat(inboundMailItem.fileId()).isEqualTo("file_makxrc67oh9l6sg7w9yc") assertThat(inboundMailItem.lockboxAddressId()) - .contains("lockbox_address_lw6sbzl9ol5dfd8hdml6") + .isEqualTo("lockbox_address_lw6sbzl9ol5dfd8hdml6") assertThat(inboundMailItem.lockboxRecipientId()).contains("lockbox_3xt21ok13q19advds4t5") assertThat(inboundMailItem.recipientName()).contains("Ian Crease") assertThat(inboundMailItem.rejectionReason()).isEmpty From 03d873f2d767dbd1ad0bc5f7be9095b5361d1693 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:36:18 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 6 +- .../AccountRevenuePaymentCreateParams.kt | 736 ++++++++++++++++++ .../services/async/SimulationServiceAsync.kt | 5 + .../async/SimulationServiceAsyncImpl.kt | 17 + .../AccountRevenuePaymentServiceAsync.kt | 69 ++ .../AccountRevenuePaymentServiceAsyncImpl.kt | 91 +++ .../services/blocking/SimulationService.kt | 5 + .../blocking/SimulationServiceImpl.kt | 15 + .../AccountRevenuePaymentService.kt | 70 ++ .../AccountRevenuePaymentServiceImpl.kt | 84 ++ .../AccountRevenuePaymentCreateParamsTest.kt | 55 ++ .../AccountRevenuePaymentServiceAsyncTest.kt | 38 + .../AccountRevenuePaymentServiceTest.kt | 37 + 13 files changed, 1225 insertions(+), 3 deletions(-) create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParams.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsync.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncImpl.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentService.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceImpl.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParamsTest.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncTest.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 42d309019..2c652835d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 236 +configured_endpoints: 237 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-47752267c48d299a01c906499bb7d584228ea8801b7d83e34ae4100d5dec3434.yml -openapi_spec_hash: ae1e2ef832ba2b284a54b8c9f9ddacdc -config_hash: 026e2baa580c7f5f2447c24332081ba8 +openapi_spec_hash: c8dcac8573c2931a496ae40613d377c4 +config_hash: 9dd89544e7c0403ccb0e0827de6a9cbf diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParams.kt new file mode 100644 index 000000000..82b4b3e1c --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParams.kt @@ -0,0 +1,736 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.simulations.accountrevenuepayments + +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.ExcludeMissing +import com.increase.api.core.JsonField +import com.increase.api.core.JsonMissing +import com.increase.api.core.JsonValue +import com.increase.api.core.Params +import com.increase.api.core.checkRequired +import com.increase.api.core.http.Headers +import com.increase.api.core.http.QueryParams +import com.increase.api.errors.IncreaseInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional + +/** + * Simulates an account revenue payment to your account. In production, this happens automatically + * on the first of each month. + */ +class AccountRevenuePaymentCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * The identifier of the Account the Account Revenue Payment should be paid to. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accountId(): String = body.accountId() + + /** + * The account revenue amount in cents. Must be positive. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun amount(): Long = body.amount() + + /** + * The identifier of the Account the account revenue accrued on. Defaults to `account_id`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accruedOnAccountId(): Optional = body.accruedOnAccountId() + + /** + * The end of the account revenue period. If not provided, defaults to the current time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun periodEnd(): Optional = body.periodEnd() + + /** + * The start of the account revenue period. If not provided, defaults to the current time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun periodStart(): Optional = body.periodStart() + + /** + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _accountId(): JsonField = body._accountId() + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _amount(): JsonField = body._amount() + + /** + * Returns the raw JSON value of [accruedOnAccountId]. + * + * Unlike [accruedOnAccountId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _accruedOnAccountId(): JsonField = body._accruedOnAccountId() + + /** + * Returns the raw JSON value of [periodEnd]. + * + * Unlike [periodEnd], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _periodEnd(): JsonField = body._periodEnd() + + /** + * Returns the raw JSON value of [periodStart]. + * + * Unlike [periodStart], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _periodStart(): JsonField = body._periodStart() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [AccountRevenuePaymentCreateParams]. + * + * The following fields are required: + * ```java + * .accountId() + * .amount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AccountRevenuePaymentCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(accountRevenuePaymentCreateParams: AccountRevenuePaymentCreateParams) = + apply { + body = accountRevenuePaymentCreateParams.body.toBuilder() + additionalHeaders = accountRevenuePaymentCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = + accountRevenuePaymentCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [accountId] + * - [amount] + * - [accruedOnAccountId] + * - [periodEnd] + * - [periodStart] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The identifier of the Account the Account Revenue Payment should be paid to. */ + fun accountId(accountId: String) = apply { body.accountId(accountId) } + + /** + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun accountId(accountId: JsonField) = apply { body.accountId(accountId) } + + /** The account revenue amount in cents. Must be positive. */ + fun amount(amount: Long) = apply { body.amount(amount) } + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun amount(amount: JsonField) = apply { body.amount(amount) } + + /** + * The identifier of the Account the account revenue accrued on. Defaults to `account_id`. + */ + fun accruedOnAccountId(accruedOnAccountId: String) = apply { + body.accruedOnAccountId(accruedOnAccountId) + } + + /** + * Sets [Builder.accruedOnAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accruedOnAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accruedOnAccountId(accruedOnAccountId: JsonField) = apply { + body.accruedOnAccountId(accruedOnAccountId) + } + + /** The end of the account revenue period. If not provided, defaults to the current time. */ + fun periodEnd(periodEnd: OffsetDateTime) = apply { body.periodEnd(periodEnd) } + + /** + * Sets [Builder.periodEnd] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEnd] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun periodEnd(periodEnd: JsonField) = apply { body.periodEnd(periodEnd) } + + /** + * The start of the account revenue period. If not provided, defaults to the current time. + */ + fun periodStart(periodStart: OffsetDateTime) = apply { body.periodStart(periodStart) } + + /** + * Sets [Builder.periodStart] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStart] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun periodStart(periodStart: JsonField) = apply { + body.periodStart(periodStart) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [AccountRevenuePaymentCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .amount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): AccountRevenuePaymentCreateParams = + AccountRevenuePaymentCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val accountId: JsonField, + private val amount: JsonField, + private val accruedOnAccountId: JsonField, + private val periodEnd: JsonField, + private val periodStart: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("account_id") + @ExcludeMissing + accountId: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("accrued_on_account_id") + @ExcludeMissing + accruedOnAccountId: JsonField = JsonMissing.of(), + @JsonProperty("period_end") + @ExcludeMissing + periodEnd: JsonField = JsonMissing.of(), + @JsonProperty("period_start") + @ExcludeMissing + periodStart: JsonField = JsonMissing.of(), + ) : this(accountId, amount, accruedOnAccountId, periodEnd, periodStart, mutableMapOf()) + + /** + * The identifier of the Account the Account Revenue Payment should be paid to. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun accountId(): String = accountId.getRequired("account_id") + + /** + * The account revenue amount in cents. Must be positive. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun amount(): Long = amount.getRequired("amount") + + /** + * The identifier of the Account the account revenue accrued on. Defaults to `account_id`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun accruedOnAccountId(): Optional = + accruedOnAccountId.getOptional("accrued_on_account_id") + + /** + * The end of the account revenue period. If not provided, defaults to the current time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun periodEnd(): Optional = periodEnd.getOptional("period_end") + + /** + * The start of the account revenue period. If not provided, defaults to the current time. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun periodStart(): Optional = periodStart.getOptional("period_start") + + /** + * Returns the raw JSON value of [accountId]. + * + * Unlike [accountId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [accruedOnAccountId]. + * + * Unlike [accruedOnAccountId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("accrued_on_account_id") + @ExcludeMissing + fun _accruedOnAccountId(): JsonField = accruedOnAccountId + + /** + * Returns the raw JSON value of [periodEnd]. + * + * Unlike [periodEnd], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("period_end") + @ExcludeMissing + fun _periodEnd(): JsonField = periodEnd + + /** + * Returns the raw JSON value of [periodStart]. + * + * Unlike [periodStart], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("period_start") + @ExcludeMissing + fun _periodStart(): JsonField = periodStart + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Body]. + * + * The following fields are required: + * ```java + * .accountId() + * .amount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var accountId: JsonField? = null + private var amount: JsonField? = null + private var accruedOnAccountId: JsonField = JsonMissing.of() + private var periodEnd: JsonField = JsonMissing.of() + private var periodStart: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + accountId = body.accountId + amount = body.amount + accruedOnAccountId = body.accruedOnAccountId + periodEnd = body.periodEnd + periodStart = body.periodStart + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The identifier of the Account the Account Revenue Payment should be paid to. */ + fun accountId(accountId: String) = accountId(JsonField.of(accountId)) + + /** + * Sets [Builder.accountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accountId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accountId(accountId: JsonField) = apply { this.accountId = accountId } + + /** The account revenue amount in cents. Must be positive. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** + * The identifier of the Account the account revenue accrued on. Defaults to + * `account_id`. + */ + fun accruedOnAccountId(accruedOnAccountId: String) = + accruedOnAccountId(JsonField.of(accruedOnAccountId)) + + /** + * Sets [Builder.accruedOnAccountId] to an arbitrary JSON value. + * + * You should usually call [Builder.accruedOnAccountId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accruedOnAccountId(accruedOnAccountId: JsonField) = apply { + this.accruedOnAccountId = accruedOnAccountId + } + + /** + * The end of the account revenue period. If not provided, defaults to the current time. + */ + fun periodEnd(periodEnd: OffsetDateTime) = periodEnd(JsonField.of(periodEnd)) + + /** + * Sets [Builder.periodEnd] to an arbitrary JSON value. + * + * You should usually call [Builder.periodEnd] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun periodEnd(periodEnd: JsonField) = apply { + this.periodEnd = periodEnd + } + + /** + * The start of the account revenue period. If not provided, defaults to the current + * time. + */ + fun periodStart(periodStart: OffsetDateTime) = periodStart(JsonField.of(periodStart)) + + /** + * Sets [Builder.periodStart] to an arbitrary JSON value. + * + * You should usually call [Builder.periodStart] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun periodStart(periodStart: JsonField) = apply { + this.periodStart = periodStart + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .accountId() + * .amount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("accountId", accountId), + checkRequired("amount", amount), + accruedOnAccountId, + periodEnd, + periodStart, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accountId() + amount() + accruedOnAccountId() + periodEnd() + periodStart() + 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 (accountId.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (accruedOnAccountId.asKnown().isPresent) 1 else 0) + + (if (periodEnd.asKnown().isPresent) 1 else 0) + + (if (periodStart.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + accountId == other.accountId && + amount == other.amount && + accruedOnAccountId == other.accruedOnAccountId && + periodEnd == other.periodEnd && + periodStart == other.periodStart && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + accountId, + amount, + accruedOnAccountId, + periodEnd, + periodStart, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{accountId=$accountId, amount=$amount, accruedOnAccountId=$accruedOnAccountId, periodEnd=$periodEnd, periodStart=$periodStart, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is AccountRevenuePaymentCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "AccountRevenuePaymentCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt index db21c187c..b6fee2199 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt @@ -3,6 +3,7 @@ package com.increase.api.services.async import com.increase.api.core.ClientOptions +import com.increase.api.services.async.simulations.AccountRevenuePaymentServiceAsync import com.increase.api.services.async.simulations.AccountStatementServiceAsync import com.increase.api.services.async.simulations.AchTransferServiceAsync import com.increase.api.services.async.simulations.CardAuthenticationServiceAsync @@ -54,6 +55,8 @@ interface SimulationServiceAsync { fun interestPayments(): InterestPaymentServiceAsync + fun accountRevenuePayments(): AccountRevenuePaymentServiceAsync + fun cardAuthorizations(): CardAuthorizationServiceAsync fun cardBalanceInquiries(): CardBalanceInquiryServiceAsync @@ -135,6 +138,8 @@ interface SimulationServiceAsync { fun interestPayments(): InterestPaymentServiceAsync.WithRawResponse + fun accountRevenuePayments(): AccountRevenuePaymentServiceAsync.WithRawResponse + fun cardAuthorizations(): CardAuthorizationServiceAsync.WithRawResponse fun cardBalanceInquiries(): CardBalanceInquiryServiceAsync.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt index f6b7fe827..d91db6188 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt @@ -3,6 +3,8 @@ package com.increase.api.services.async import com.increase.api.core.ClientOptions +import com.increase.api.services.async.simulations.AccountRevenuePaymentServiceAsync +import com.increase.api.services.async.simulations.AccountRevenuePaymentServiceAsyncImpl import com.increase.api.services.async.simulations.AccountStatementServiceAsync import com.increase.api.services.async.simulations.AccountStatementServiceAsyncImpl import com.increase.api.services.async.simulations.AchTransferServiceAsync @@ -82,6 +84,10 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: InterestPaymentServiceAsyncImpl(clientOptions) } + private val accountRevenuePayments: AccountRevenuePaymentServiceAsync by lazy { + AccountRevenuePaymentServiceAsyncImpl(clientOptions) + } + private val cardAuthorizations: CardAuthorizationServiceAsync by lazy { CardAuthorizationServiceAsyncImpl(clientOptions) } @@ -214,6 +220,9 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun interestPayments(): InterestPaymentServiceAsync = interestPayments + override fun accountRevenuePayments(): AccountRevenuePaymentServiceAsync = + accountRevenuePayments + override fun cardAuthorizations(): CardAuthorizationServiceAsync = cardAuthorizations override fun cardBalanceInquiries(): CardBalanceInquiryServiceAsync = cardBalanceInquiries @@ -293,6 +302,11 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: InterestPaymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val accountRevenuePayments: + AccountRevenuePaymentServiceAsync.WithRawResponse by lazy { + AccountRevenuePaymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val cardAuthorizations: CardAuthorizationServiceAsync.WithRawResponse by lazy { CardAuthorizationServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -440,6 +454,9 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun interestPayments(): InterestPaymentServiceAsync.WithRawResponse = interestPayments + override fun accountRevenuePayments(): AccountRevenuePaymentServiceAsync.WithRawResponse = + accountRevenuePayments + override fun cardAuthorizations(): CardAuthorizationServiceAsync.WithRawResponse = cardAuthorizations diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsync.kt new file mode 100644 index 000000000..9d2593f2c --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsync.kt @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.async.simulations + +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.models.simulations.accountrevenuepayments.AccountRevenuePaymentCreateParams +import com.increase.api.models.transactions.Transaction +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface AccountRevenuePaymentServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AccountRevenuePaymentServiceAsync + + /** + * Simulates an account revenue payment to your account. In production, this happens + * automatically on the first of each month. + */ + fun create(params: AccountRevenuePaymentCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [AccountRevenuePaymentServiceAsync] that provides access to raw HTTP responses for + * each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): AccountRevenuePaymentServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /simulations/account_revenue_payments`, but is + * otherwise the same as [AccountRevenuePaymentServiceAsync.create]. + */ + fun create( + params: AccountRevenuePaymentCreateParams + ): CompletableFuture> = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncImpl.kt new file mode 100644 index 000000000..70248d3c0 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncImpl.kt @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.async.simulations + +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.handlers.errorBodyHandler +import com.increase.api.core.handlers.errorHandler +import com.increase.api.core.handlers.jsonHandler +import com.increase.api.core.http.HttpMethod +import com.increase.api.core.http.HttpRequest +import com.increase.api.core.http.HttpResponse +import com.increase.api.core.http.HttpResponse.Handler +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.core.http.json +import com.increase.api.core.http.parseable +import com.increase.api.core.prepareAsync +import com.increase.api.models.simulations.accountrevenuepayments.AccountRevenuePaymentCreateParams +import com.increase.api.models.transactions.Transaction +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +class AccountRevenuePaymentServiceAsyncImpl +internal constructor(private val clientOptions: ClientOptions) : AccountRevenuePaymentServiceAsync { + + private val withRawResponse: AccountRevenuePaymentServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): AccountRevenuePaymentServiceAsync.WithRawResponse = + withRawResponse + + override fun withOptions( + modifier: Consumer + ): AccountRevenuePaymentServiceAsync = + AccountRevenuePaymentServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /simulations/account_revenue_payments + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccountRevenuePaymentServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): AccountRevenuePaymentServiceAsync.WithRawResponse = + AccountRevenuePaymentServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("simulations", "account_revenue_payments") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt index 95deddf78..49aa6aa3b 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt @@ -3,6 +3,7 @@ package com.increase.api.services.blocking import com.increase.api.core.ClientOptions +import com.increase.api.services.blocking.simulations.AccountRevenuePaymentService import com.increase.api.services.blocking.simulations.AccountStatementService import com.increase.api.services.blocking.simulations.AchTransferService import com.increase.api.services.blocking.simulations.CardAuthenticationService @@ -54,6 +55,8 @@ interface SimulationService { fun interestPayments(): InterestPaymentService + fun accountRevenuePayments(): AccountRevenuePaymentService + fun cardAuthorizations(): CardAuthorizationService fun cardBalanceInquiries(): CardBalanceInquiryService @@ -132,6 +135,8 @@ interface SimulationService { fun interestPayments(): InterestPaymentService.WithRawResponse + fun accountRevenuePayments(): AccountRevenuePaymentService.WithRawResponse + fun cardAuthorizations(): CardAuthorizationService.WithRawResponse fun cardBalanceInquiries(): CardBalanceInquiryService.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt index 149cec552..17b6f4502 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt @@ -3,6 +3,8 @@ package com.increase.api.services.blocking import com.increase.api.core.ClientOptions +import com.increase.api.services.blocking.simulations.AccountRevenuePaymentService +import com.increase.api.services.blocking.simulations.AccountRevenuePaymentServiceImpl import com.increase.api.services.blocking.simulations.AccountStatementService import com.increase.api.services.blocking.simulations.AccountStatementServiceImpl import com.increase.api.services.blocking.simulations.AchTransferService @@ -82,6 +84,10 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie InterestPaymentServiceImpl(clientOptions) } + private val accountRevenuePayments: AccountRevenuePaymentService by lazy { + AccountRevenuePaymentServiceImpl(clientOptions) + } + private val cardAuthorizations: CardAuthorizationService by lazy { CardAuthorizationServiceImpl(clientOptions) } @@ -205,6 +211,8 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun interestPayments(): InterestPaymentService = interestPayments + override fun accountRevenuePayments(): AccountRevenuePaymentService = accountRevenuePayments + override fun cardAuthorizations(): CardAuthorizationService = cardAuthorizations override fun cardBalanceInquiries(): CardBalanceInquiryService = cardBalanceInquiries @@ -282,6 +290,10 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie InterestPaymentServiceImpl.WithRawResponseImpl(clientOptions) } + private val accountRevenuePayments: AccountRevenuePaymentService.WithRawResponse by lazy { + AccountRevenuePaymentServiceImpl.WithRawResponseImpl(clientOptions) + } + private val cardAuthorizations: CardAuthorizationService.WithRawResponse by lazy { CardAuthorizationServiceImpl.WithRawResponseImpl(clientOptions) } @@ -425,6 +437,9 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun interestPayments(): InterestPaymentService.WithRawResponse = interestPayments + override fun accountRevenuePayments(): AccountRevenuePaymentService.WithRawResponse = + accountRevenuePayments + override fun cardAuthorizations(): CardAuthorizationService.WithRawResponse = cardAuthorizations diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentService.kt new file mode 100644 index 000000000..b7b52735b --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentService.kt @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.blocking.simulations + +import com.google.errorprone.annotations.MustBeClosed +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.models.simulations.accountrevenuepayments.AccountRevenuePaymentCreateParams +import com.increase.api.models.transactions.Transaction +import java.util.function.Consumer + +interface AccountRevenuePaymentService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): AccountRevenuePaymentService + + /** + * Simulates an account revenue payment to your account. In production, this happens + * automatically on the first of each month. + */ + fun create(params: AccountRevenuePaymentCreateParams): Transaction = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): Transaction + + /** + * A view of [AccountRevenuePaymentService] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): AccountRevenuePaymentService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /simulations/account_revenue_payments`, but is + * otherwise the same as [AccountRevenuePaymentService.create]. + */ + @MustBeClosed + fun create(params: AccountRevenuePaymentCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceImpl.kt new file mode 100644 index 000000000..3b93d0a41 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceImpl.kt @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.blocking.simulations + +import com.increase.api.core.ClientOptions +import com.increase.api.core.RequestOptions +import com.increase.api.core.handlers.errorBodyHandler +import com.increase.api.core.handlers.errorHandler +import com.increase.api.core.handlers.jsonHandler +import com.increase.api.core.http.HttpMethod +import com.increase.api.core.http.HttpRequest +import com.increase.api.core.http.HttpResponse +import com.increase.api.core.http.HttpResponse.Handler +import com.increase.api.core.http.HttpResponseFor +import com.increase.api.core.http.json +import com.increase.api.core.http.parseable +import com.increase.api.core.prepare +import com.increase.api.models.simulations.accountrevenuepayments.AccountRevenuePaymentCreateParams +import com.increase.api.models.transactions.Transaction +import java.util.function.Consumer + +class AccountRevenuePaymentServiceImpl +internal constructor(private val clientOptions: ClientOptions) : AccountRevenuePaymentService { + + private val withRawResponse: AccountRevenuePaymentService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): AccountRevenuePaymentService.WithRawResponse = withRawResponse + + override fun withOptions( + modifier: Consumer + ): AccountRevenuePaymentService = + AccountRevenuePaymentServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions, + ): Transaction = + // post /simulations/account_revenue_payments + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + AccountRevenuePaymentService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): AccountRevenuePaymentService.WithRawResponse = + AccountRevenuePaymentServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: AccountRevenuePaymentCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("simulations", "account_revenue_payments") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParamsTest.kt new file mode 100644 index 000000000..adc90c775 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accountrevenuepayments/AccountRevenuePaymentCreateParamsTest.kt @@ -0,0 +1,55 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.simulations.accountrevenuepayments + +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class AccountRevenuePaymentCreateParamsTest { + + @Test + fun create() { + AccountRevenuePaymentCreateParams.builder() + .accountId("account_in71c4amph0vgo2qllky") + .amount(1000L) + .accruedOnAccountId("accrued_on_account_id") + .periodEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + } + + @Test + fun body() { + val params = + AccountRevenuePaymentCreateParams.builder() + .accountId("account_in71c4amph0vgo2qllky") + .amount(1000L) + .accruedOnAccountId("accrued_on_account_id") + .periodEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val body = params._body() + + assertThat(body.accountId()).isEqualTo("account_in71c4amph0vgo2qllky") + assertThat(body.amount()).isEqualTo(1000L) + assertThat(body.accruedOnAccountId()).contains("accrued_on_account_id") + assertThat(body.periodEnd()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(body.periodStart()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + AccountRevenuePaymentCreateParams.builder() + .accountId("account_in71c4amph0vgo2qllky") + .amount(1000L) + .build() + + val body = params._body() + + assertThat(body.accountId()).isEqualTo("account_in71c4amph0vgo2qllky") + assertThat(body.amount()).isEqualTo(1000L) + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncTest.kt new file mode 100644 index 000000000..9973cff22 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountRevenuePaymentServiceAsyncTest.kt @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.async.simulations + +import com.increase.api.TestServerExtension +import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync +import com.increase.api.models.simulations.accountrevenuepayments.AccountRevenuePaymentCreateParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class AccountRevenuePaymentServiceAsyncTest { + + @Test + fun create() { + val client = + IncreaseOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val accountRevenuePaymentServiceAsync = client.simulations().accountRevenuePayments() + + val transactionFuture = + accountRevenuePaymentServiceAsync.create( + AccountRevenuePaymentCreateParams.builder() + .accountId("account_in71c4amph0vgo2qllky") + .amount(1000L) + .accruedOnAccountId("accrued_on_account_id") + .periodEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val transaction = transactionFuture.get() + transaction.validate() + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceTest.kt new file mode 100644 index 000000000..6def36bec --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountRevenuePaymentServiceTest.kt @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.services.blocking.simulations + +import com.increase.api.TestServerExtension +import com.increase.api.client.okhttp.IncreaseOkHttpClient +import com.increase.api.models.simulations.accountrevenuepayments.AccountRevenuePaymentCreateParams +import java.time.OffsetDateTime +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class AccountRevenuePaymentServiceTest { + + @Test + fun create() { + val client = + IncreaseOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val accountRevenuePaymentService = client.simulations().accountRevenuePayments() + + val transaction = + accountRevenuePaymentService.create( + AccountRevenuePaymentCreateParams.builder() + .accountId("account_in71c4amph0vgo2qllky") + .amount(1000L) + .accruedOnAccountId("accrued_on_account_id") + .periodEnd(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .periodStart(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + transaction.validate() + } +} From 5aaddf22be38318ec3465949fed0430faf7f3699 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:37:05 +0000 Subject: [PATCH 3/3] release: 0.528.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4e142e6e8..c1afac195 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.527.0" + ".": "0.528.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cd911c133..0b9a2ff15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.528.0 (2026-04-28) + +Full Changelog: [v0.527.0...v0.528.0](https://github.com/Increase/increase-java/compare/v0.527.0...v0.528.0) + +### Features + +* **api:** api update ([03d873f](https://github.com/Increase/increase-java/commit/03d873f2d767dbd1ad0bc5f7be9095b5361d1693)) +* **api:** api update ([33d199d](https://github.com/Increase/increase-java/commit/33d199d4111e60cd48a390263194841c00d540e7)) + ## 0.527.0 (2026-04-27) Full Changelog: [v0.526.0...v0.527.0](https://github.com/Increase/increase-java/compare/v0.526.0...v0.527.0) diff --git a/README.md b/README.md index e81c77bbd..33fab8824 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.527.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.527.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.527.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.528.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.528.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.528.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.527.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.528.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.527.0") +implementation("com.increase.api:increase-java:0.528.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.527.0") com.increase.api increase-java - 0.527.0 + 0.528.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index b84ca2f80..53b07dc74 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.527.0" // x-release-please-version + version = "0.528.0" // x-release-please-version } subprojects {