diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e93bb367d..6109efc46 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.518.0" + ".": "0.519.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index bf45bd24b..2e4362b30 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-05341d7f8aa36455db1b6bb5f613a08ee7c7beba3e868c7e18befe429cfd7625.yml -openapi_spec_hash: 321b419c81281651e70db5ab2549af67 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-b8ef37fb2b33cb0aa49fe69ed2efb55eee614c2c90f74da9611f48083d59de6d.yml +openapi_spec_hash: 3453655d92ccd0c10398971cdd1d7aa6 config_hash: cb5b8736705c06b670f6a25484622d62 diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4ee4f56..772b4c8ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.519.0 (2026-04-16) + +Full Changelog: [v0.518.0...v0.519.0](https://github.com/Increase/increase-java/compare/v0.518.0...v0.519.0) + +### Features + +* **api:** api update ([3bdeff1](https://github.com/Increase/increase-java/commit/3bdeff1373783b414942d4160f2bc2ac127d1afd)) + ## 0.518.0 (2026-04-16) Full Changelog: [v0.517.0...v0.518.0](https://github.com/Increase/increase-java/compare/v0.517.0...v0.518.0) diff --git a/README.md b/README.md index dab84bb4f..7d489e38b 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.518.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.518.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.518.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.519.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.519.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.519.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.518.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.519.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.518.0") +implementation("com.increase.api:increase-java:0.519.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.518.0") com.increase.api increase-java - 0.518.0 + 0.519.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 70d0cb107..7490c47d5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.518.0" // x-release-please-version + version = "0.519.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt index 5584b3792..28e8b04d2 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/events/EventListParams.kt @@ -24,6 +24,7 @@ private constructor( private val createdAt: CreatedAt?, private val cursor: String?, private val limit: Long?, + private val orderBy: OrderBy?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -41,6 +42,8 @@ private constructor( /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ fun limit(): Optional = Optional.ofNullable(limit) + fun orderBy(): Optional = Optional.ofNullable(orderBy) + /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -65,6 +68,7 @@ private constructor( private var createdAt: CreatedAt? = null private var cursor: String? = null private var limit: Long? = null + private var orderBy: OrderBy? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -75,6 +79,7 @@ private constructor( createdAt = eventListParams.createdAt cursor = eventListParams.cursor limit = eventListParams.limit + orderBy = eventListParams.orderBy additionalHeaders = eventListParams.additionalHeaders.toBuilder() additionalQueryParams = eventListParams.additionalQueryParams.toBuilder() } @@ -121,6 +126,11 @@ private constructor( /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ fun limit(limit: Optional) = limit(limit.getOrNull()) + fun orderBy(orderBy: OrderBy?) = apply { this.orderBy = orderBy } + + /** Alias for calling [Builder.orderBy] with `orderBy.orElse(null)`. */ + fun orderBy(orderBy: Optional) = orderBy(orderBy.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -231,6 +241,7 @@ private constructor( createdAt, cursor, limit, + orderBy, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -279,6 +290,15 @@ private constructor( } cursor?.let { put("cursor", it) } limit?.let { put("limit", it.toString()) } + orderBy?.let { + it.direction().ifPresent { put("order_by.direction", it.toString()) } + it.field().ifPresent { put("order_by.field", it.toString()) } + it._additionalProperties().keys().forEach { key -> + it._additionalProperties().values(key).forEach { value -> + put("order_by.$key", value) + } + } + } putAll(additionalQueryParams) } .build() @@ -1818,6 +1838,397 @@ private constructor( "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" } + class OrderBy + private constructor( + private val direction: Direction?, + private val field: Field?, + private val additionalProperties: QueryParams, + ) { + + /** The direction to order in. */ + fun direction(): Optional = Optional.ofNullable(direction) + + /** The field to order by. */ + fun field(): Optional = Optional.ofNullable(field) + + /** Query params to send with the request. */ + fun _additionalProperties(): QueryParams = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [OrderBy]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [OrderBy]. */ + class Builder internal constructor() { + + private var direction: Direction? = null + private var field: Field? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(orderBy: OrderBy) = apply { + direction = orderBy.direction + field = orderBy.field + additionalProperties = orderBy.additionalProperties.toBuilder() + } + + /** The direction to order in. */ + fun direction(direction: Direction?) = apply { this.direction = direction } + + /** Alias for calling [Builder.direction] with `direction.orElse(null)`. */ + fun direction(direction: Optional) = direction(direction.getOrNull()) + + /** The field to order by. */ + fun field(field: Field?) = apply { this.field = field } + + /** Alias for calling [Builder.field] with `field.orElse(null)`. */ + fun field(field: Optional) = field(field.getOrNull()) + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + /** + * Returns an immutable instance of [OrderBy]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): OrderBy = OrderBy(direction, field, additionalProperties.build()) + } + + /** The direction to order in. */ + class Direction @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** Ascending in value. */ + @JvmField val ASCENDING = of("ascending") + + /** Descending in value. */ + @JvmField val DESCENDING = of("descending") + + @JvmStatic fun of(value: String) = Direction(JsonField.of(value)) + } + + /** An enum containing [Direction]'s known values. */ + enum class Known { + /** Ascending in value. */ + ASCENDING, + /** Descending in value. */ + DESCENDING, + } + + /** + * An enum containing [Direction]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Direction] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** Ascending in value. */ + ASCENDING, + /** Descending in value. */ + DESCENDING, + /** + * An enum member indicating that [Direction] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ASCENDING -> Value.ASCENDING + DESCENDING -> Value.DESCENDING + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + ASCENDING -> Known.ASCENDING + DESCENDING -> Known.DESCENDING + else -> throw IncreaseInvalidDataException("Unknown Direction: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Direction = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Direction && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The field to order by. */ + class Field @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + /** The time the Event was created. */ + @JvmField val CREATED_AT = of("created_at") + + @JvmStatic fun of(value: String) = Field(JsonField.of(value)) + } + + /** An enum containing [Field]'s known values. */ + enum class Known { + /** The time the Event was created. */ + CREATED_AT + } + + /** + * An enum containing [Field]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Field] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The time the Event was created. */ + CREATED_AT, + /** + * An enum member indicating that [Field] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CREATED_AT -> Value.CREATED_AT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + CREATED_AT -> Known.CREATED_AT + else -> throw IncreaseInvalidDataException("Unknown Field: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Field = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Field && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is OrderBy && + direction == other.direction && + field == other.field && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(direction, field, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "OrderBy{direction=$direction, field=$field, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1829,6 +2240,7 @@ private constructor( createdAt == other.createdAt && cursor == other.cursor && limit == other.limit && + orderBy == other.orderBy && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } @@ -1840,10 +2252,11 @@ private constructor( createdAt, cursor, limit, + orderBy, additionalHeaders, additionalQueryParams, ) override fun toString() = - "EventListParams{associatedObjectId=$associatedObjectId, category=$category, createdAt=$createdAt, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "EventListParams{associatedObjectId=$associatedObjectId, category=$category, createdAt=$createdAt, cursor=$cursor, limit=$limit, orderBy=$orderBy, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/events/EventListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/events/EventListParamsTest.kt index 45cdf028a..c4b0f202a 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/events/EventListParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/events/EventListParamsTest.kt @@ -28,6 +28,12 @@ internal class EventListParamsTest { ) .cursor("cursor") .limit(1L) + .orderBy( + EventListParams.OrderBy.builder() + .direction(EventListParams.OrderBy.Direction.ASCENDING) + .field(EventListParams.OrderBy.Field.CREATED_AT) + .build() + ) .build() } @@ -51,6 +57,12 @@ internal class EventListParamsTest { ) .cursor("cursor") .limit(1L) + .orderBy( + EventListParams.OrderBy.builder() + .direction(EventListParams.OrderBy.Direction.ASCENDING) + .field(EventListParams.OrderBy.Field.CREATED_AT) + .build() + ) .build() val queryParams = params._queryParams() @@ -66,6 +78,8 @@ internal class EventListParamsTest { .put("created_at.on_or_before", "2019-12-27T18:11:19.117Z") .put("cursor", "cursor") .put("limit", "1") + .put("order_by.direction", "ascending") + .put("order_by.field", "created_at") .build() ) }