diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2b878682b..c01949a9c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.508.0" + ".": "0.509.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 238fb5aa2..3a06ad510 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 241 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-16584f71f31837a98f04250e08aec539fd7eb0bf69178b0e6b24254642f6755f.yml -openapi_spec_hash: a67f1f1147858e6b2143b5215fc80e04 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-9cc37a5650ead65f77fe88834795d2e80f5f0f79e474d15030145f8303835a4f.yml +openapi_spec_hash: 68ec4be9e1dd4153a3175ad41a36352f config_hash: d48e9f65bcf642f92610034d6c43f07a diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1dad3a7..1a92d8ea5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.509.0 (2026-04-10) + +Full Changelog: [v0.508.0...v0.509.0](https://github.com/Increase/increase-java/compare/v0.508.0...v0.509.0) + +### Features + +* **api:** api update ([6c10766](https://github.com/Increase/increase-java/commit/6c10766bea646ed4a4eb4869fcddf417c24af1a2)) + ## 0.508.0 (2026-04-10) Full Changelog: [v0.507.0...v0.508.0](https://github.com/Increase/increase-java/compare/v0.507.0...v0.508.0) diff --git a/README.md b/README.md index 9b820e237..b0e0992b3 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.508.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.508.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.508.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.509.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.509.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.509.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.508.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.509.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.508.0") +implementation("com.increase.api:increase-java:0.509.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.508.0") com.increase.api increase-java - 0.508.0 + 0.509.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 3abcc061d..bee85c7be 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.508.0" // x-release-please-version + version = "0.509.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/exports/Export.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/exports/Export.kt index b3462aec4..6d61ac39c 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/exports/Export.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/exports/Export.kt @@ -2572,7 +2572,8 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val bookkeepingAccountId: JsonField, - private val createdAt: JsonField, + private val onOrAfterDate: JsonField, + private val onOrBeforeDate: JsonField, private val additionalProperties: MutableMap, ) { @@ -2581,10 +2582,13 @@ private constructor( @JsonProperty("bookkeeping_account_id") @ExcludeMissing bookkeepingAccountId: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("on_or_after_date") @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - ) : this(bookkeepingAccountId, createdAt, mutableMapOf()) + onOrAfterDate: JsonField = JsonMissing.of(), + @JsonProperty("on_or_before_date") + @ExcludeMissing + onOrBeforeDate: JsonField = JsonMissing.of(), + ) : this(bookkeepingAccountId, onOrAfterDate, onOrBeforeDate, mutableMapOf()) /** * Filter results by Bookkeeping Account. @@ -2596,12 +2600,20 @@ private constructor( bookkeepingAccountId.getOptional("bookkeeping_account_id") /** - * Filter balances by their created date. + * Filter balances to those on or after this date. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun createdAt(): Optional = createdAt.getOptional("created_at") + fun onOrAfterDate(): Optional = onOrAfterDate.getOptional("on_or_after_date") + + /** + * Filter balances to those on or before this date. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun onOrBeforeDate(): Optional = onOrBeforeDate.getOptional("on_or_before_date") /** * Returns the raw JSON value of [bookkeepingAccountId]. @@ -2614,13 +2626,24 @@ private constructor( fun _bookkeepingAccountId(): JsonField = bookkeepingAccountId /** - * Returns the raw JSON value of [createdAt]. + * Returns the raw JSON value of [onOrAfterDate]. * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [onOrAfterDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("created_at") + @JsonProperty("on_or_after_date") @ExcludeMissing - fun _createdAt(): JsonField = createdAt + fun _onOrAfterDate(): JsonField = onOrAfterDate + + /** + * Returns the raw JSON value of [onOrBeforeDate]. + * + * Unlike [onOrBeforeDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("on_or_before_date") + @ExcludeMissing + fun _onOrBeforeDate(): JsonField = onOrBeforeDate @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -2643,7 +2666,8 @@ private constructor( * The following fields are required: * ```java * .bookkeepingAccountId() - * .createdAt() + * .onOrAfterDate() + * .onOrBeforeDate() * ``` */ @JvmStatic fun builder() = Builder() @@ -2653,13 +2677,15 @@ private constructor( class Builder internal constructor() { private var bookkeepingAccountId: JsonField? = null - private var createdAt: JsonField? = null + private var onOrAfterDate: JsonField? = null + private var onOrBeforeDate: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(bookkeepingAccountBalanceCsv: BookkeepingAccountBalanceCsv) = apply { bookkeepingAccountId = bookkeepingAccountBalanceCsv.bookkeepingAccountId - createdAt = bookkeepingAccountBalanceCsv.createdAt + onOrAfterDate = bookkeepingAccountBalanceCsv.onOrAfterDate + onOrBeforeDate = bookkeepingAccountBalanceCsv.onOrBeforeDate additionalProperties = bookkeepingAccountBalanceCsv.additionalProperties.toMutableMap() } @@ -2686,20 +2712,43 @@ private constructor( this.bookkeepingAccountId = bookkeepingAccountId } - /** Filter balances by their created date. */ - fun createdAt(createdAt: CreatedAt?) = createdAt(JsonField.ofNullable(createdAt)) + /** Filter balances to those on or after this date. */ + fun onOrAfterDate(onOrAfterDate: LocalDate?) = + onOrAfterDate(JsonField.ofNullable(onOrAfterDate)) - /** Alias for calling [Builder.createdAt] with `createdAt.orElse(null)`. */ - fun createdAt(createdAt: Optional) = createdAt(createdAt.getOrNull()) + /** Alias for calling [Builder.onOrAfterDate] with `onOrAfterDate.orElse(null)`. */ + fun onOrAfterDate(onOrAfterDate: Optional) = + onOrAfterDate(onOrAfterDate.getOrNull()) /** - * Sets [Builder.createdAt] to an arbitrary JSON value. + * Sets [Builder.onOrAfterDate] to an arbitrary JSON value. * - * You should usually call [Builder.createdAt] with a well-typed [CreatedAt] value + * You should usually call [Builder.onOrAfterDate] with a well-typed [LocalDate] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + fun onOrAfterDate(onOrAfterDate: JsonField) = apply { + this.onOrAfterDate = onOrAfterDate + } + + /** Filter balances to those on or before this date. */ + fun onOrBeforeDate(onOrBeforeDate: LocalDate?) = + onOrBeforeDate(JsonField.ofNullable(onOrBeforeDate)) + + /** Alias for calling [Builder.onOrBeforeDate] with `onOrBeforeDate.orElse(null)`. */ + fun onOrBeforeDate(onOrBeforeDate: Optional) = + onOrBeforeDate(onOrBeforeDate.getOrNull()) + + /** + * Sets [Builder.onOrBeforeDate] to an arbitrary JSON value. + * + * You should usually call [Builder.onOrBeforeDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun onOrBeforeDate(onOrBeforeDate: JsonField) = apply { + this.onOrBeforeDate = onOrBeforeDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2728,7 +2777,8 @@ private constructor( * The following fields are required: * ```java * .bookkeepingAccountId() - * .createdAt() + * .onOrAfterDate() + * .onOrBeforeDate() * ``` * * @throws IllegalStateException if any required field is unset. @@ -2736,7 +2786,8 @@ private constructor( fun build(): BookkeepingAccountBalanceCsv = BookkeepingAccountBalanceCsv( checkRequired("bookkeepingAccountId", bookkeepingAccountId), - checkRequired("createdAt", createdAt), + checkRequired("onOrAfterDate", onOrAfterDate), + checkRequired("onOrBeforeDate", onOrBeforeDate), additionalProperties.toMutableMap(), ) } @@ -2749,7 +2800,8 @@ private constructor( } bookkeepingAccountId() - createdAt().ifPresent { it.validate() } + onOrAfterDate() + onOrBeforeDate() validated = true } @@ -2770,221 +2822,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (bookkeepingAccountId.asKnown().isPresent) 1 else 0) + - (createdAt.asKnown().getOrNull()?.validity() ?: 0) - - /** Filter balances by their created date. */ - class CreatedAt - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val after: JsonField, - private val before: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("after") - @ExcludeMissing - after: JsonField = JsonMissing.of(), - @JsonProperty("before") - @ExcludeMissing - before: JsonField = JsonMissing.of(), - ) : this(after, before, mutableMapOf()) - - /** - * Filter balances created after this time. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun after(): Optional = after.getOptional("after") - - /** - * Filter balances created before this time. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun before(): Optional = before.getOptional("before") - - /** - * Returns the raw JSON value of [after]. - * - * Unlike [after], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("after") @ExcludeMissing fun _after(): JsonField = after - - /** - * Returns the raw JSON value of [before]. - * - * Unlike [before], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("before") - @ExcludeMissing - fun _before(): JsonField = before - - @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 [CreatedAt]. - * - * The following fields are required: - * ```java - * .after() - * .before() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CreatedAt]. */ - class Builder internal constructor() { - - private var after: JsonField? = null - private var before: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(createdAt: CreatedAt) = apply { - after = createdAt.after - before = createdAt.before - additionalProperties = createdAt.additionalProperties.toMutableMap() - } - - /** Filter balances created after this time. */ - fun after(after: OffsetDateTime?) = after(JsonField.ofNullable(after)) - - /** Alias for calling [Builder.after] with `after.orElse(null)`. */ - fun after(after: Optional) = after(after.getOrNull()) - - /** - * Sets [Builder.after] to an arbitrary JSON value. - * - * You should usually call [Builder.after] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun after(after: JsonField) = apply { this.after = after } - - /** Filter balances created before this time. */ - fun before(before: OffsetDateTime?) = before(JsonField.ofNullable(before)) - - /** Alias for calling [Builder.before] with `before.orElse(null)`. */ - fun before(before: Optional) = before(before.getOrNull()) - - /** - * Sets [Builder.before] to an arbitrary JSON value. - * - * You should usually call [Builder.before] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun before(before: JsonField) = apply { this.before = before } - - 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 [CreatedAt]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .after() - * .before() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CreatedAt = - CreatedAt( - checkRequired("after", after), - checkRequired("before", before), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CreatedAt = apply { - if (validated) { - return@apply - } - - after() - before() - 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 (after.asKnown().isPresent) 1 else 0) + - (if (before.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreatedAt && - after == other.after && - before == other.before && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(after, before, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CreatedAt{after=$after, before=$before, additionalProperties=$additionalProperties}" - } + (if (onOrAfterDate.asKnown().isPresent) 1 else 0) + + (if (onOrBeforeDate.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -2993,18 +2832,19 @@ private constructor( return other is BookkeepingAccountBalanceCsv && bookkeepingAccountId == other.bookkeepingAccountId && - createdAt == other.createdAt && + onOrAfterDate == other.onOrAfterDate && + onOrBeforeDate == other.onOrBeforeDate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(bookkeepingAccountId, createdAt, additionalProperties) + Objects.hash(bookkeepingAccountId, onOrAfterDate, onOrBeforeDate, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "BookkeepingAccountBalanceCsv{bookkeepingAccountId=$bookkeepingAccountId, createdAt=$createdAt, additionalProperties=$additionalProperties}" + "BookkeepingAccountBalanceCsv{bookkeepingAccountId=$bookkeepingAccountId, onOrAfterDate=$onOrAfterDate, onOrBeforeDate=$onOrBeforeDate, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/exports/ExportCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/exports/ExportCreateParams.kt index eeff670cf..5641377be 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/exports/ExportCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/exports/ExportCreateParams.kt @@ -2909,7 +2909,8 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val bookkeepingAccountId: JsonField, - private val createdAt: JsonField, + private val onOrAfterDate: JsonField, + private val onOrBeforeDate: JsonField, private val additionalProperties: MutableMap, ) { @@ -2918,10 +2919,13 @@ private constructor( @JsonProperty("bookkeeping_account_id") @ExcludeMissing bookkeepingAccountId: JsonField = JsonMissing.of(), - @JsonProperty("created_at") + @JsonProperty("on_or_after_date") @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - ) : this(bookkeepingAccountId, createdAt, mutableMapOf()) + onOrAfterDate: JsonField = JsonMissing.of(), + @JsonProperty("on_or_before_date") + @ExcludeMissing + onOrBeforeDate: JsonField = JsonMissing.of(), + ) : this(bookkeepingAccountId, onOrAfterDate, onOrBeforeDate, mutableMapOf()) /** * Filter exported Bookkeeping Account Balances to the specified Bookkeeping Account. @@ -2933,12 +2937,20 @@ private constructor( bookkeepingAccountId.getOptional("bookkeeping_account_id") /** - * Filter results by time range on the `created_at` attribute. + * Filter exported Balances to those on or after this date. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun createdAt(): Optional = createdAt.getOptional("created_at") + fun onOrAfterDate(): Optional = onOrAfterDate.getOptional("on_or_after_date") + + /** + * Filter exported Balances to those on or before this date. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun onOrBeforeDate(): Optional = onOrBeforeDate.getOptional("on_or_before_date") /** * Returns the raw JSON value of [bookkeepingAccountId]. @@ -2951,13 +2963,24 @@ private constructor( fun _bookkeepingAccountId(): JsonField = bookkeepingAccountId /** - * Returns the raw JSON value of [createdAt]. + * Returns the raw JSON value of [onOrAfterDate]. * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [onOrAfterDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("created_at") + @JsonProperty("on_or_after_date") @ExcludeMissing - fun _createdAt(): JsonField = createdAt + fun _onOrAfterDate(): JsonField = onOrAfterDate + + /** + * Returns the raw JSON value of [onOrBeforeDate]. + * + * Unlike [onOrBeforeDate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("on_or_before_date") + @ExcludeMissing + fun _onOrBeforeDate(): JsonField = onOrBeforeDate @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -2984,13 +3007,15 @@ private constructor( class Builder internal constructor() { private var bookkeepingAccountId: JsonField = JsonMissing.of() - private var createdAt: JsonField = JsonMissing.of() + private var onOrAfterDate: JsonField = JsonMissing.of() + private var onOrBeforeDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(bookkeepingAccountBalanceCsv: BookkeepingAccountBalanceCsv) = apply { bookkeepingAccountId = bookkeepingAccountBalanceCsv.bookkeepingAccountId - createdAt = bookkeepingAccountBalanceCsv.createdAt + onOrAfterDate = bookkeepingAccountBalanceCsv.onOrAfterDate + onOrBeforeDate = bookkeepingAccountBalanceCsv.onOrBeforeDate additionalProperties = bookkeepingAccountBalanceCsv.additionalProperties.toMutableMap() } @@ -3012,17 +3037,34 @@ private constructor( this.bookkeepingAccountId = bookkeepingAccountId } - /** Filter results by time range on the `created_at` attribute. */ - fun createdAt(createdAt: CreatedAt) = createdAt(JsonField.of(createdAt)) + /** Filter exported Balances to those on or after this date. */ + fun onOrAfterDate(onOrAfterDate: LocalDate) = onOrAfterDate(JsonField.of(onOrAfterDate)) /** - * Sets [Builder.createdAt] to an arbitrary JSON value. + * Sets [Builder.onOrAfterDate] to an arbitrary JSON value. * - * You should usually call [Builder.createdAt] with a well-typed [CreatedAt] value + * You should usually call [Builder.onOrAfterDate] with a well-typed [LocalDate] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + fun onOrAfterDate(onOrAfterDate: JsonField) = apply { + this.onOrAfterDate = onOrAfterDate + } + + /** Filter exported Balances to those on or before this date. */ + fun onOrBeforeDate(onOrBeforeDate: LocalDate) = + onOrBeforeDate(JsonField.of(onOrBeforeDate)) + + /** + * Sets [Builder.onOrBeforeDate] to an arbitrary JSON value. + * + * You should usually call [Builder.onOrBeforeDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun onOrBeforeDate(onOrBeforeDate: JsonField) = apply { + this.onOrBeforeDate = onOrBeforeDate + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3051,7 +3093,8 @@ private constructor( fun build(): BookkeepingAccountBalanceCsv = BookkeepingAccountBalanceCsv( bookkeepingAccountId, - createdAt, + onOrAfterDate, + onOrBeforeDate, additionalProperties.toMutableMap(), ) } @@ -3064,7 +3107,8 @@ private constructor( } bookkeepingAccountId() - createdAt().ifPresent { it.validate() } + onOrAfterDate() + onOrBeforeDate() validated = true } @@ -3085,301 +3129,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (bookkeepingAccountId.asKnown().isPresent) 1 else 0) + - (createdAt.asKnown().getOrNull()?.validity() ?: 0) - - /** Filter results by time range on the `created_at` attribute. */ - class CreatedAt - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val after: JsonField, - private val before: JsonField, - private val onOrAfter: JsonField, - private val onOrBefore: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("after") - @ExcludeMissing - after: JsonField = JsonMissing.of(), - @JsonProperty("before") - @ExcludeMissing - before: JsonField = JsonMissing.of(), - @JsonProperty("on_or_after") - @ExcludeMissing - onOrAfter: JsonField = JsonMissing.of(), - @JsonProperty("on_or_before") - @ExcludeMissing - onOrBefore: JsonField = JsonMissing.of(), - ) : this(after, before, onOrAfter, onOrBefore, mutableMapOf()) - - /** - * Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun after(): Optional = after.getOptional("after") - - /** - * Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun before(): Optional = before.getOptional("before") - - /** - * Return results on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun onOrAfter(): Optional = onOrAfter.getOptional("on_or_after") - - /** - * Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun onOrBefore(): Optional = onOrBefore.getOptional("on_or_before") - - /** - * Returns the raw JSON value of [after]. - * - * Unlike [after], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("after") @ExcludeMissing fun _after(): JsonField = after - - /** - * Returns the raw JSON value of [before]. - * - * Unlike [before], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("before") - @ExcludeMissing - fun _before(): JsonField = before - - /** - * Returns the raw JSON value of [onOrAfter]. - * - * Unlike [onOrAfter], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("on_or_after") - @ExcludeMissing - fun _onOrAfter(): JsonField = onOrAfter - - /** - * Returns the raw JSON value of [onOrBefore]. - * - * Unlike [onOrBefore], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("on_or_before") - @ExcludeMissing - fun _onOrBefore(): JsonField = onOrBefore - - @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 [CreatedAt]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CreatedAt]. */ - class Builder internal constructor() { - - private var after: JsonField = JsonMissing.of() - private var before: JsonField = JsonMissing.of() - private var onOrAfter: JsonField = JsonMissing.of() - private var onOrBefore: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(createdAt: CreatedAt) = apply { - after = createdAt.after - before = createdAt.before - onOrAfter = createdAt.onOrAfter - onOrBefore = createdAt.onOrBefore - additionalProperties = createdAt.additionalProperties.toMutableMap() - } - - /** - * Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun after(after: OffsetDateTime) = after(JsonField.of(after)) - - /** - * Sets [Builder.after] to an arbitrary JSON value. - * - * You should usually call [Builder.after] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun after(after: JsonField) = apply { this.after = after } - - /** - * Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun before(before: OffsetDateTime) = before(JsonField.of(before)) - - /** - * Sets [Builder.before] to an arbitrary JSON value. - * - * You should usually call [Builder.before] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun before(before: JsonField) = apply { this.before = before } - - /** - * Return results on or after this - * [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. - */ - fun onOrAfter(onOrAfter: OffsetDateTime) = onOrAfter(JsonField.of(onOrAfter)) - - /** - * Sets [Builder.onOrAfter] to an arbitrary JSON value. - * - * You should usually call [Builder.onOrAfter] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun onOrAfter(onOrAfter: JsonField) = apply { - this.onOrAfter = onOrAfter - } - - /** - * Return results on or before this - * [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. - */ - fun onOrBefore(onOrBefore: OffsetDateTime) = onOrBefore(JsonField.of(onOrBefore)) - - /** - * Sets [Builder.onOrBefore] to an arbitrary JSON value. - * - * You should usually call [Builder.onOrBefore] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun onOrBefore(onOrBefore: JsonField) = apply { - this.onOrBefore = onOrBefore - } - - 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 [CreatedAt]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CreatedAt = - CreatedAt( - after, - before, - onOrAfter, - onOrBefore, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CreatedAt = apply { - if (validated) { - return@apply - } - - after() - before() - onOrAfter() - onOrBefore() - 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 (after.asKnown().isPresent) 1 else 0) + - (if (before.asKnown().isPresent) 1 else 0) + - (if (onOrAfter.asKnown().isPresent) 1 else 0) + - (if (onOrBefore.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreatedAt && - after == other.after && - before == other.before && - onOrAfter == other.onOrAfter && - onOrBefore == other.onOrBefore && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(after, before, onOrAfter, onOrBefore, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" - } + (if (onOrAfterDate.asKnown().isPresent) 1 else 0) + + (if (onOrBeforeDate.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -3388,18 +3139,19 @@ private constructor( return other is BookkeepingAccountBalanceCsv && bookkeepingAccountId == other.bookkeepingAccountId && - createdAt == other.createdAt && + onOrAfterDate == other.onOrAfterDate && + onOrBeforeDate == other.onOrBeforeDate && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(bookkeepingAccountId, createdAt, additionalProperties) + Objects.hash(bookkeepingAccountId, onOrAfterDate, onOrBeforeDate, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "BookkeepingAccountBalanceCsv{bookkeepingAccountId=$bookkeepingAccountId, createdAt=$createdAt, additionalProperties=$additionalProperties}" + "BookkeepingAccountBalanceCsv{bookkeepingAccountId=$bookkeepingAccountId, onOrAfterDate=$onOrAfterDate, onOrBeforeDate=$onOrBeforeDate, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportCreateParamsTest.kt index de0534cde..a6b54d3e1 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportCreateParamsTest.kt @@ -53,14 +53,8 @@ internal class ExportCreateParamsTest { .bookkeepingAccountBalanceCsv( ExportCreateParams.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - ExportCreateParams.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .dailyAccountBalanceCsv( @@ -144,14 +138,8 @@ internal class ExportCreateParamsTest { .bookkeepingAccountBalanceCsv( ExportCreateParams.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - ExportCreateParams.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .dailyAccountBalanceCsv( @@ -237,14 +225,8 @@ internal class ExportCreateParamsTest { .contains( ExportCreateParams.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - ExportCreateParams.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) assertThat(body.dailyAccountBalanceCsv()) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportListPageResponseTest.kt index 539454d3f..88060004f 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportListPageResponseTest.kt @@ -56,12 +56,8 @@ internal class ExportListPageResponseTest { .bookkeepingAccountBalanceCsv( Export.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - Export.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .category(Export.Category.TRANSACTION_CSV) @@ -174,12 +170,8 @@ internal class ExportListPageResponseTest { .bookkeepingAccountBalanceCsv( Export.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - Export.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .category(Export.Category.TRANSACTION_CSV) @@ -296,12 +288,8 @@ internal class ExportListPageResponseTest { .bookkeepingAccountBalanceCsv( Export.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - Export.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .category(Export.Category.TRANSACTION_CSV) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportTest.kt index a6e8e7ca5..9ab002edb 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/exports/ExportTest.kt @@ -54,12 +54,8 @@ internal class ExportTest { .bookkeepingAccountBalanceCsv( Export.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - Export.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .category(Export.Category.TRANSACTION_CSV) @@ -171,12 +167,8 @@ internal class ExportTest { .contains( Export.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - Export.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) assertThat(export.category()).isEqualTo(Export.Category.TRANSACTION_CSV) @@ -294,12 +286,8 @@ internal class ExportTest { .bookkeepingAccountBalanceCsv( Export.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - Export.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .category(Export.Category.TRANSACTION_CSV) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/ExportServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/ExportServiceAsyncTest.kt index 328acd7a5..5c5eccf72 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/ExportServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/ExportServiceAsyncTest.kt @@ -66,14 +66,8 @@ internal class ExportServiceAsyncTest { .bookkeepingAccountBalanceCsv( ExportCreateParams.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - ExportCreateParams.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .dailyAccountBalanceCsv( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/ExportServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/ExportServiceTest.kt index 3e4b094f2..e4b697cc8 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/ExportServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/ExportServiceTest.kt @@ -66,14 +66,8 @@ internal class ExportServiceTest { .bookkeepingAccountBalanceCsv( ExportCreateParams.BookkeepingAccountBalanceCsv.builder() .bookkeepingAccountId("bookkeeping_account_id") - .createdAt( - ExportCreateParams.BookkeepingAccountBalanceCsv.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) + .onOrAfterDate(LocalDate.parse("2019-12-27")) + .onOrBeforeDate(LocalDate.parse("2019-12-27")) .build() ) .dailyAccountBalanceCsv(