Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ jobs:

- name: Run tests
run: ./scripts/test

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.48.0"
".": "0.49.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- x-release-please-start-version -->

[![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)

<!-- x-release-please-end -->

Expand All @@ -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
Expand All @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.48.0")
<dependency>
<groupId>com.withorb.api</groupId>
<artifactId>orb-java</artifactId>
<version>0.48.0</version>
<version>0.49.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<OffsetDateTime> = Optional.ofNullable(createdAtGt)

fun createdAtGte(): Optional<OffsetDateTime> = Optional.ofNullable(createdAtGte)

fun createdAtLt(): Optional<OffsetDateTime> = Optional.ofNullable(createdAtLt)

fun createdAtLte(): Optional<OffsetDateTime> = Optional.ofNullable(createdAtLte)

/**
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
Expand All @@ -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)
Expand All @@ -60,19 +98,47 @@ 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()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()

@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<OffsetDateTime>) =
createdAtGt(createdAtGt.getOrNull())

fun createdAtGte(createdAtGte: OffsetDateTime?) = apply { this.createdAtGte = createdAtGte }

fun createdAtGte(createdAtGte: Optional<OffsetDateTime>) =
createdAtGte(createdAtGte.getOrNull())

fun createdAtLt(createdAtLt: OffsetDateTime?) = apply { this.createdAtLt = createdAtLt }

fun createdAtLt(createdAtLt: Optional<OffsetDateTime>) =
createdAtLt(createdAtLt.getOrNull())

fun createdAtLte(createdAtLte: OffsetDateTime?) = apply { this.createdAtLte = createdAtLte }

fun createdAtLte(createdAtLte: Optional<OffsetDateTime>) =
createdAtLte(createdAtLte.getOrNull())

/**
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
Expand Down Expand Up @@ -194,6 +260,10 @@ private constructor(

fun build(): CreditNoteListParams =
CreditNoteListParams(
createdAtGt,
createdAtGte,
createdAtLt,
createdAtLte,
cursor,
limit,
additionalHeaders.build(),
Expand All @@ -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}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private constructor(
private val createdAtLte: OffsetDateTime?,
private val cursor: String?,
private val customerId: List<String>?,
private val externalCustomerId: String?,
private val externalCustomerId: List<String>?,
private val limit: Long?,
private val status: Status?,
private val additionalHeaders: Headers,
Expand All @@ -58,7 +58,7 @@ private constructor(

fun customerId(): Optional<List<String>> = Optional.ofNullable(customerId)

fun externalCustomerId(): Optional<String> = Optional.ofNullable(externalCustomerId)
fun externalCustomerId(): Optional<List<String>> = Optional.ofNullable(externalCustomerId)

/** The number of items to fetch. Defaults to 20. */
fun limit(): Optional<Long> = Optional.ofNullable(limit)
Expand Down Expand Up @@ -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())) }
Expand Down Expand Up @@ -128,7 +128,7 @@ private constructor(
private var createdAtLte: OffsetDateTime? = null
private var cursor: String? = null
private var customerId: MutableList<String>? = null
private var externalCustomerId: String? = null
private var externalCustomerId: MutableList<String>? = null
private var limit: Long? = null
private var status: Status? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
Expand All @@ -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()
Expand Down Expand Up @@ -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<String>?) = apply {
this.externalCustomerId = externalCustomerId?.toMutableList()
}

fun externalCustomerId(externalCustomerId: Optional<String>) =
fun externalCustomerId(externalCustomerId: Optional<List<String>>) =
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 }

Expand Down Expand Up @@ -317,7 +322,7 @@ private constructor(
createdAtLte,
cursor,
customerId?.toImmutable(),
externalCustomerId,
externalCustomerId?.toImmutable(),
limit,
status,
additionalHeaders.build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,40 @@
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

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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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())
Expand Down
Loading