diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 121ace973..94046873c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,4 +52,3 @@ jobs: - name: Run tests run: ./scripts/test - diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ff6612050..dd7ced1c3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.48.0" + ".": "0.49.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a9fd94449..85c391c8a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-979330185e8fda7b2bc2440075fe81c66132fc87ff3c548e93dd05db35ba3172.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-aeb94d91af916dbff0132ee7c4501df9223609b19fef0398a1a495e7a432ee36.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b55a824..a2108f114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.49.0 (2025-03-14) + +Full Changelog: [v0.48.0...v0.49.0](https://github.com/orbcorp/orb-java/compare/v0.48.0...v0.49.0) + +### Features + +* **api:** api update ([#341](https://github.com/orbcorp/orb-java/issues/341)) ([3d8a83b](https://github.com/orbcorp/orb-java/commit/3d8a83bab9ac6fe453be2450ee0db32ee07c16c9)) + + +### Chores + +* **api:** correctly support ExternalCustomerID array filter on Subscriptions.List ([#340](https://github.com/orbcorp/orb-java/issues/340)) ([f5c8c0b](https://github.com/orbcorp/orb-java/commit/f5c8c0b4e7debfa773bc040831fa9935ca981215)) +* **internal:** remove extra empty newlines ([#338](https://github.com/orbcorp/orb-java/issues/338)) ([fb8b1a2](https://github.com/orbcorp/orb-java/commit/fb8b1a215c5397eef151a4dc0d33810b37c745b8)) + ## 0.48.0 (2025-03-11) Full Changelog: [v0.47.0...v0.48.0](https://github.com/orbcorp/orb-java/compare/v0.47.0...v0.48.0) diff --git a/README.md b/README.md index 9bfc02748..81ae4219f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.48.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.49.0) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-java:0.48.0") +implementation("com.withorb.api:orb-java:0.49.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.48.0") com.withorb.api orb-java - 0.48.0 + 0.49.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 8b401fdd6..62208c16c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.48.0" // x-release-please-version + version = "0.49.0" // x-release-please-version } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt index 897ef1b0c..d837ce60c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListParams.kt @@ -6,6 +6,8 @@ import com.withorb.api.core.NoAutoDetect import com.withorb.api.core.Params import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -17,12 +19,24 @@ import kotlin.jvm.optionals.getOrNull */ class CreditNoteListParams private constructor( + private val createdAtGt: OffsetDateTime?, + private val createdAtGte: OffsetDateTime?, + private val createdAtLt: OffsetDateTime?, + private val createdAtLte: OffsetDateTime?, private val cursor: String?, private val limit: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { + fun createdAtGt(): Optional = Optional.ofNullable(createdAtGt) + + fun createdAtGte(): Optional = Optional.ofNullable(createdAtGte) + + fun createdAtLt(): Optional = Optional.ofNullable(createdAtLt) + + fun createdAtLte(): Optional = Optional.ofNullable(createdAtLte) + /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the * initial request. @@ -40,6 +54,30 @@ private constructor( override fun _queryParams(): QueryParams { val queryParams = QueryParams.builder() + this.createdAtGt?.let { + queryParams.put( + "created_at[gt]", + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), + ) + } + this.createdAtGte?.let { + queryParams.put( + "created_at[gte]", + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), + ) + } + this.createdAtLt?.let { + queryParams.put( + "created_at[lt]", + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), + ) + } + this.createdAtLte?.let { + queryParams.put( + "created_at[lte]", + listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)), + ) + } this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } this.limit?.let { queryParams.put("limit", listOf(it.toString())) } queryParams.putAll(additionalQueryParams) @@ -60,6 +98,10 @@ private constructor( @NoAutoDetect class Builder internal constructor() { + private var createdAtGt: OffsetDateTime? = null + private var createdAtGte: OffsetDateTime? = null + private var createdAtLt: OffsetDateTime? = null + private var createdAtLte: OffsetDateTime? = null private var cursor: String? = null private var limit: Long? = null private var additionalHeaders: Headers.Builder = Headers.builder() @@ -67,12 +109,36 @@ private constructor( @JvmSynthetic internal fun from(creditNoteListParams: CreditNoteListParams) = apply { + createdAtGt = creditNoteListParams.createdAtGt + createdAtGte = creditNoteListParams.createdAtGte + createdAtLt = creditNoteListParams.createdAtLt + createdAtLte = creditNoteListParams.createdAtLte cursor = creditNoteListParams.cursor limit = creditNoteListParams.limit additionalHeaders = creditNoteListParams.additionalHeaders.toBuilder() additionalQueryParams = creditNoteListParams.additionalQueryParams.toBuilder() } + fun createdAtGt(createdAtGt: OffsetDateTime?) = apply { this.createdAtGt = createdAtGt } + + fun createdAtGt(createdAtGt: Optional) = + createdAtGt(createdAtGt.getOrNull()) + + fun createdAtGte(createdAtGte: OffsetDateTime?) = apply { this.createdAtGte = createdAtGte } + + fun createdAtGte(createdAtGte: Optional) = + createdAtGte(createdAtGte.getOrNull()) + + fun createdAtLt(createdAtLt: OffsetDateTime?) = apply { this.createdAtLt = createdAtLt } + + fun createdAtLt(createdAtLt: Optional) = + createdAtLt(createdAtLt.getOrNull()) + + fun createdAtLte(createdAtLte: OffsetDateTime?) = apply { this.createdAtLte = createdAtLte } + + fun createdAtLte(createdAtLte: Optional) = + createdAtLte(createdAtLte.getOrNull()) + /** * Cursor for pagination. This can be populated by the `next_cursor` value returned from the * initial request. @@ -194,6 +260,10 @@ private constructor( fun build(): CreditNoteListParams = CreditNoteListParams( + createdAtGt, + createdAtGte, + createdAtLt, + createdAtLte, cursor, limit, additionalHeaders.build(), @@ -206,11 +276,11 @@ private constructor( return true } - return /* spotless:off */ other is CreditNoteListParams && cursor == other.cursor && limit == other.limit && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is CreditNoteListParams && createdAtGt == other.createdAtGt && createdAtGte == other.createdAtGte && createdAtLt == other.createdAtLt && createdAtLte == other.createdAtLte && cursor == other.cursor && limit == other.limit && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(createdAtGt, createdAtGte, createdAtLt, createdAtLte, cursor, limit, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "CreditNoteListParams{cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "CreditNoteListParams{createdAtGt=$createdAtGt, createdAtGte=$createdAtGte, createdAtLt=$createdAtLt, createdAtLte=$createdAtLte, cursor=$cursor, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt index 16371547b..d6d13224f 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionListParams.kt @@ -35,7 +35,7 @@ private constructor( private val createdAtLte: OffsetDateTime?, private val cursor: String?, private val customerId: List?, - private val externalCustomerId: String?, + private val externalCustomerId: List?, private val limit: Long?, private val status: Status?, private val additionalHeaders: Headers, @@ -58,7 +58,7 @@ private constructor( fun customerId(): Optional> = Optional.ofNullable(customerId) - fun externalCustomerId(): Optional = Optional.ofNullable(externalCustomerId) + fun externalCustomerId(): Optional> = Optional.ofNullable(externalCustomerId) /** The number of items to fetch. Defaults to 20. */ fun limit(): Optional = Optional.ofNullable(limit) @@ -100,7 +100,7 @@ private constructor( this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) } this.customerId?.let { queryParams.put("customer_id[]", it.map(Any::toString)) } this.externalCustomerId?.let { - queryParams.put("external_customer_id", listOf(it.toString())) + queryParams.put("external_customer_id[]", it.map(Any::toString)) } this.limit?.let { queryParams.put("limit", listOf(it.toString())) } this.status?.let { queryParams.put("status", listOf(it.toString())) } @@ -128,7 +128,7 @@ private constructor( private var createdAtLte: OffsetDateTime? = null private var cursor: String? = null private var customerId: MutableList? = null - private var externalCustomerId: String? = null + private var externalCustomerId: MutableList? = null private var limit: Long? = null private var status: Status? = null private var additionalHeaders: Headers.Builder = Headers.builder() @@ -142,7 +142,7 @@ private constructor( createdAtLte = subscriptionListParams.createdAtLte cursor = subscriptionListParams.cursor customerId = subscriptionListParams.customerId?.toMutableList() - externalCustomerId = subscriptionListParams.externalCustomerId + externalCustomerId = subscriptionListParams.externalCustomerId?.toMutableList() limit = subscriptionListParams.limit status = subscriptionListParams.status additionalHeaders = subscriptionListParams.additionalHeaders.toBuilder() @@ -191,13 +191,18 @@ private constructor( this.customerId = (this.customerId ?: mutableListOf()).apply { add(customerId) } } - fun externalCustomerId(externalCustomerId: String?) = apply { - this.externalCustomerId = externalCustomerId + fun externalCustomerId(externalCustomerId: List?) = apply { + this.externalCustomerId = externalCustomerId?.toMutableList() } - fun externalCustomerId(externalCustomerId: Optional) = + fun externalCustomerId(externalCustomerId: Optional>) = externalCustomerId(externalCustomerId.getOrNull()) + fun addExternalCustomerId(externalCustomerId: String) = apply { + this.externalCustomerId = + (this.externalCustomerId ?: mutableListOf()).apply { add(externalCustomerId) } + } + /** The number of items to fetch. Defaults to 20. */ fun limit(limit: Long?) = apply { this.limit = limit } @@ -317,7 +322,7 @@ private constructor( createdAtLte, cursor, customerId?.toImmutable(), - externalCustomerId, + externalCustomerId?.toImmutable(), limit, status, additionalHeaders.build(), diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListParamsTest.kt index b17b33146..c4bef0bd0 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListParamsTest.kt @@ -3,6 +3,7 @@ package com.withorb.api.models import com.withorb.api.core.http.QueryParams +import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -10,13 +11,32 @@ class CreditNoteListParamsTest { @Test fun create() { - CreditNoteListParams.builder().cursor("cursor").limit(1L).build() + CreditNoteListParams.builder() + .createdAtGt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtGte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtLt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtLte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .cursor("cursor") + .limit(1L) + .build() } @Test fun queryParams() { - val params = CreditNoteListParams.builder().cursor("cursor").limit(1L).build() + val params = + CreditNoteListParams.builder() + .createdAtGt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtGte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtLt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .createdAtLte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .cursor("cursor") + .limit(1L) + .build() val expected = QueryParams.builder() + expected.put("created_at[gt]", "2019-12-27T18:11:19.117Z") + expected.put("created_at[gte]", "2019-12-27T18:11:19.117Z") + expected.put("created_at[lt]", "2019-12-27T18:11:19.117Z") + expected.put("created_at[lte]", "2019-12-27T18:11:19.117Z") expected.put("cursor", "cursor") expected.put("limit", "1") assertThat(params._queryParams()).isEqualTo(expected.build()) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionListParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionListParamsTest.kt index 54c0cf169..efecf39b8 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionListParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionListParamsTest.kt @@ -18,7 +18,7 @@ class SubscriptionListParamsTest { .createdAtLte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .cursor("cursor") .addCustomerId("string") - .externalCustomerId("external_customer_id") + .addExternalCustomerId("string") .limit(1L) .status(SubscriptionListParams.Status.ACTIVE) .build() @@ -34,7 +34,7 @@ class SubscriptionListParamsTest { .createdAtLte(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .cursor("cursor") .addCustomerId("string") - .externalCustomerId("external_customer_id") + .addExternalCustomerId("string") .limit(1L) .status(SubscriptionListParams.Status.ACTIVE) .build() @@ -45,7 +45,7 @@ class SubscriptionListParamsTest { expected.put("created_at[lte]", "2019-12-27T18:11:19.117Z") expected.put("cursor", "cursor") expected.put("customer_id[]", "string") - expected.put("external_customer_id", "external_customer_id") + expected.put("external_customer_id[]", "string") expected.put("limit", "1") expected.put("status", SubscriptionListParams.Status.ACTIVE.toString()) assertThat(params._queryParams()).isEqualTo(expected.build())