diff --git a/.gitignore b/.gitignore
index 39c31e3e..4e81838d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
.prism.log
.gradle
.idea
+.kotlin
build
codegen.log
kls_database.db
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 563004f2..5ba086cf 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.46.0"
+ ".": "0.46.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d536f76..4ed86daa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Changelog
+## 0.46.1 (2025-03-07)
+
+Full Changelog: [v0.46.0...v0.46.1](https://github.com/orbcorp/orb-java/compare/v0.46.0...v0.46.1)
+
+### Chores
+
+* **internal:** add `.kotlin` to `.gitignore` ([#323](https://github.com/orbcorp/orb-java/issues/323)) ([8c1f105](https://github.com/orbcorp/orb-java/commit/8c1f105f073072041491eeffed999a31957c4c5e))
+* **internal:** codegen related update ([#321](https://github.com/orbcorp/orb-java/issues/321)) ([a45ffe2](https://github.com/orbcorp/orb-java/commit/a45ffe29a6f89939a7c624efac74e5ce890ca7d9))
+* **internal:** don't generate docs ([#325](https://github.com/orbcorp/orb-java/issues/325)) ([dccfa35](https://github.com/orbcorp/orb-java/commit/dccfa351f867c99eddac02c5603ac59cf892a7ef))
+* **internal:** use `getOrNull` instead of `orElse(null)` ([#324](https://github.com/orbcorp/orb-java/issues/324)) ([02fd429](https://github.com/orbcorp/orb-java/commit/02fd429784de8fe4a0ae0d4eee9fbe1544080c92))
+
## 0.46.0 (2025-03-07)
Full Changelog: [v0.45.0...v0.46.0](https://github.com/orbcorp/orb-java/compare/v0.45.0...v0.46.0)
diff --git a/README.md b/README.md
index 77d4d1f5..928d92f0 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.46.0)
-[](https://javadoc.io/doc/com.withorb.api/orb-java/0.46.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.46.1)
@@ -11,7 +10,7 @@ The Orb Java SDK provides convenient access to the Orb REST API from application
The Orb Java SDK is similar to the Orb Kotlin SDK but with minor differences that make it more ergonomic for use in Java, such as `Optional` instead of nullable values, `Stream` instead of `Sequence`, and `CompletableFuture` instead of suspend functions.
-The REST API documentation can be found on [docs.withorb.com](https://docs.withorb.com/reference/api-reference). Javadocs are also available on [javadoc.io](https://javadoc.io/doc/com.withorb.api/orb-java/0.45.0).
+The REST API documentation can be found on [docs.withorb.com](https://docs.withorb.com/reference/api-reference).
## Installation
@@ -20,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.46.0")
+implementation("com.withorb.api:orb-java:0.46.1")
```
### Maven
@@ -29,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.46.0")
com.withorb.api
orb-java
- 0.46.0
+ 0.46.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 61ab6577..45f8d5a0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,23 +1,4 @@
-plugins {
- id("org.jetbrains.dokka") version "2.0.0"
-}
-
-repositories {
- mavenCentral()
-}
-
allprojects {
group = "com.withorb.api"
- version = "0.46.0" // x-release-please-version
-}
-
-subprojects {
- apply(plugin = "org.jetbrains.dokka")
-}
-
-// Avoid race conditions between `dokkaJavadocCollector` and `dokkaJavadocJar` tasks
-tasks.named("dokkaJavadocCollector").configure {
- subprojects.flatMap { it.tasks }
- .filter { it.project.name != "orb-java" && it.name == "dokkaJavadocJar" }
- .forEach { mustRunAfter(it) }
+ version = "0.46.1" // x-release-please-version
}
diff --git a/buildSrc/src/main/kotlin/orb.publish.gradle.kts b/buildSrc/src/main/kotlin/orb.publish.gradle.kts
index 2f9d4b55..134e81fe 100644
--- a/buildSrc/src/main/kotlin/orb.publish.gradle.kts
+++ b/buildSrc/src/main/kotlin/orb.publish.gradle.kts
@@ -1,5 +1,3 @@
-import com.vanniktech.maven.publish.JavadocJar
-import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
@@ -21,12 +19,6 @@ configure {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
coordinates(project.group.toString(), project.name, project.version.toString())
- configure(
- KotlinJvm(
- javadocJar = JavadocJar.Dokka("dokkaJavadoc"),
- sourcesJar = true,
- )
- )
pom {
name.set("API Reference")
diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
index ba060e8a..1677b6fa 100644
--- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
+++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
@@ -13,6 +13,7 @@ import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
class OrbOkHttpClient private constructor() {
@@ -150,7 +151,7 @@ class OrbOkHttpClient private constructor() {
}
fun webhookSecret(webhookSecret: Optional) =
- webhookSecret(webhookSecret.orElse(null))
+ webhookSecret(webhookSecret.getOrNull())
fun fromEnv() = apply { clientOptions.fromEnv() }
diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
index b8ec3451..68cb22b4 100644
--- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
+++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
@@ -13,6 +13,7 @@ import java.net.Proxy
import java.time.Clock
import java.time.Duration
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
class OrbOkHttpClientAsync private constructor() {
@@ -150,7 +151,7 @@ class OrbOkHttpClientAsync private constructor() {
}
fun webhookSecret(webhookSecret: Optional) =
- webhookSecret(webhookSecret.orElse(null))
+ webhookSecret(webhookSecret.getOrNull())
fun fromEnv() = apply { clientOptions.fromEnv() }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
index 2c3ce89b..03889ebc 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
@@ -10,6 +10,7 @@ import com.withorb.api.core.http.QueryParams
import com.withorb.api.core.http.RetryingHttpClient
import java.time.Clock
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
class ClientOptions
private constructor(
@@ -100,7 +101,7 @@ private constructor(
fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret }
fun webhookSecret(webhookSecret: Optional) =
- webhookSecret(webhookSecret.orElse(null))
+ webhookSecret(webhookSecret.getOrNull())
fun headers(headers: Headers) = apply {
this.headers.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Timeout.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Timeout.kt
index 65438bf4..b1336402 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Timeout.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Timeout.kt
@@ -5,6 +5,7 @@ package com.withorb.api.core
import java.time.Duration
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/** A class containing timeouts for various processing phases of a request. */
class Timeout
@@ -96,7 +97,7 @@ private constructor(
*
* Defaults to `Duration.ofMinutes(1)`.
*/
- fun connect(connect: Optional) = connect(connect.orElse(null))
+ fun connect(connect: Optional) = connect(connect.getOrNull())
/**
* The maximum time allowed between two data packets when waiting for the server’s response.
@@ -114,7 +115,7 @@ private constructor(
*
* Defaults to `request()`.
*/
- fun read(read: Optional) = read(read.orElse(null))
+ fun read(read: Optional) = read(read.getOrNull())
/**
* The maximum time allowed between two data packets when sending the request to the server.
@@ -132,7 +133,7 @@ private constructor(
*
* Defaults to `request()`.
*/
- fun write(write: Optional) = write(write.orElse(null))
+ fun write(write: Optional) = write(write.getOrNull())
/**
* The maximum time allowed for a complete HTTP call, not including retries.
@@ -156,7 +157,7 @@ private constructor(
*
* Defaults to `Duration.ofMinutes(1)`.
*/
- fun request(request: Optional) = request(request.orElse(null))
+ fun request(request: Optional) = request(request.getOrNull())
fun build(): Timeout = Timeout(connect, read, write, request)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
index 9390ddc8..77cfdfbf 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
@@ -20,6 +20,7 @@ import com.withorb.api.errors.OrbInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or credit
@@ -220,7 +221,7 @@ private constructor(
fun currency(currency: String?) = currency(JsonField.ofNullable(currency))
/** The name of the currency the credit balance or invoice cost is denominated in. */
- fun currency(currency: Optional) = currency(currency.orElse(null))
+ fun currency(currency: Optional) = currency(currency.getOrNull())
/** The name of the currency the credit balance or invoice cost is denominated in. */
fun currency(currency: JsonField) = apply { this.currency = currency }
@@ -229,7 +230,7 @@ private constructor(
fun customer(customer: Customer?) = customer(JsonField.ofNullable(customer))
/** The customer the alert applies to. */
- fun customer(customer: Optional) = customer(customer.orElse(null))
+ fun customer(customer: Optional) = customer(customer.getOrNull())
/** The customer the alert applies to. */
fun customer(customer: JsonField) = apply { this.customer = customer }
@@ -244,7 +245,7 @@ private constructor(
fun metric(metric: Metric?) = metric(JsonField.ofNullable(metric))
/** The metric the alert applies to. */
- fun metric(metric: Optional) = metric(metric.orElse(null))
+ fun metric(metric: Optional) = metric(metric.getOrNull())
/** The metric the alert applies to. */
fun metric(metric: JsonField) = apply { this.metric = metric }
@@ -253,7 +254,7 @@ private constructor(
fun plan(plan: Plan?) = plan(JsonField.ofNullable(plan))
/** The plan the alert applies to. */
- fun plan(plan: Optional) = plan(plan.orElse(null))
+ fun plan(plan: Optional) = plan(plan.getOrNull())
/** The plan the alert applies to. */
fun plan(plan: JsonField) = apply { this.plan = plan }
@@ -264,7 +265,7 @@ private constructor(
/** The subscription the alert applies to. */
fun subscription(subscription: Optional) =
- subscription(subscription.orElse(null))
+ subscription(subscription.getOrNull())
/** The subscription the alert applies to. */
fun subscription(subscription: JsonField) = apply {
@@ -275,7 +276,7 @@ private constructor(
fun thresholds(thresholds: List?) = thresholds(JsonField.ofNullable(thresholds))
/** The thresholds that define the conditions under which the alert will be triggered. */
- fun thresholds(thresholds: Optional>) = thresholds(thresholds.orElse(null))
+ fun thresholds(thresholds: Optional>) = thresholds(thresholds.getOrNull())
/** The thresholds that define the conditions under which the alert will be triggered. */
fun thresholds(thresholds: JsonField>) = apply {
@@ -409,7 +410,7 @@ private constructor(
externalCustomerId(JsonField.ofNullable(externalCustomerId))
fun externalCustomerId(externalCustomerId: Optional) =
- externalCustomerId(externalCustomerId.orElse(null))
+ externalCustomerId(externalCustomerId.getOrNull())
fun externalCustomerId(externalCustomerId: JsonField) = apply {
this.externalCustomerId = externalCustomerId
@@ -666,7 +667,7 @@ private constructor(
fun id(id: String?) = id(JsonField.ofNullable(id))
- fun id(id: Optional) = id(id.orElse(null))
+ fun id(id: Optional) = id(id.getOrNull())
fun id(id: JsonField) = apply { this.id = id }
@@ -684,7 +685,7 @@ private constructor(
* your system.
*/
fun externalPlanId(externalPlanId: Optional) =
- externalPlanId(externalPlanId.orElse(null))
+ externalPlanId(externalPlanId.getOrNull())
/**
* An optional user-defined ID for this plan resource, used throughout the system as an
@@ -697,7 +698,7 @@ private constructor(
fun name(name: String?) = name(JsonField.ofNullable(name))
- fun name(name: Optional) = name(name.orElse(null))
+ fun name(name: Optional) = name(name.getOrNull())
fun name(name: JsonField) = apply { this.name = name }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
index 7889c0bf..ff46bd2c 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
@@ -22,6 +22,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint creates a new alert to monitor a customer's credit balance. There are three types
@@ -181,7 +182,7 @@ private constructor(
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: Optional>) =
- thresholds(thresholds.orElse(null))
+ thresholds(thresholds.getOrNull())
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: JsonField>) = apply {
@@ -294,7 +295,7 @@ private constructor(
fun thresholds(thresholds: List?) = apply { body.thresholds(thresholds) }
/** The thresholds that define the values at which the alert will be triggered. */
- fun thresholds(thresholds: Optional>) = thresholds(thresholds.orElse(null))
+ fun thresholds(thresholds: Optional>) = thresholds(thresholds.getOrNull())
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: JsonField>) = apply {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
index 365b7cdf..b95bcf61 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
@@ -22,6 +22,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint creates a new alert to monitor a customer's credit balance. There are three types
@@ -181,7 +182,7 @@ private constructor(
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: Optional>) =
- thresholds(thresholds.orElse(null))
+ thresholds(thresholds.getOrNull())
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: JsonField>) = apply {
@@ -300,7 +301,7 @@ private constructor(
fun thresholds(thresholds: List?) = apply { body.thresholds(thresholds) }
/** The thresholds that define the values at which the alert will be triggered. */
- fun thresholds(thresholds: Optional>) = thresholds(thresholds.orElse(null))
+ fun thresholds(thresholds: Optional>) = thresholds(thresholds.getOrNull())
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: JsonField>) = apply {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
index 48e4caf2..03477d54 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
@@ -22,6 +22,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint is used to create alerts at the subscription level.
@@ -192,7 +193,7 @@ private constructor(
fun metricId(metricId: String?) = metricId(JsonField.ofNullable(metricId))
/** The metric to track usage for. */
- fun metricId(metricId: Optional) = metricId(metricId.orElse(null))
+ fun metricId(metricId: Optional) = metricId(metricId.getOrNull())
/** The metric to track usage for. */
fun metricId(metricId: JsonField) = apply { this.metricId = metricId }
@@ -303,7 +304,7 @@ private constructor(
fun metricId(metricId: String?) = apply { body.metricId(metricId) }
/** The metric to track usage for. */
- fun metricId(metricId: Optional) = metricId(metricId.orElse(null))
+ fun metricId(metricId: Optional) = metricId(metricId.getOrNull())
/** The metric to track usage for. */
fun metricId(metricId: JsonField) = apply { body.metricId(metricId) }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt
index 548ba857..a437d108 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt
@@ -11,6 +11,7 @@ import com.withorb.api.core.http.QueryParams
import com.withorb.api.core.toImmutable
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint allows you to disable an alert. To disable a plan-level alert for a specific
@@ -100,7 +101,7 @@ private constructor(
/** Used to update the status of a plan alert scoped to this subscription_id */
fun subscriptionId(subscriptionId: Optional) =
- subscriptionId(subscriptionId.orElse(null))
+ subscriptionId(subscriptionId.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt
index c73bf567..de3a2b6d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt
@@ -11,6 +11,7 @@ import com.withorb.api.core.http.QueryParams
import com.withorb.api.core.toImmutable
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint allows you to enable an alert. To enable a plan-level alert for a specific
@@ -100,7 +101,7 @@ private constructor(
/** Used to update the status of a plan alert scoped to this subscription_id */
fun subscriptionId(subscriptionId: Optional) =
- subscriptionId(subscriptionId.orElse(null))
+ subscriptionId(subscriptionId.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
index a186921b..3c0aa1e2 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
@@ -18,6 +18,7 @@ import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint returns a list of alerts within Orb.
@@ -191,7 +192,7 @@ private constructor(
while (index < page.data().size) {
yield(page.data()[index++])
}
- page = page.getNextPage().orElse(null) ?: break
+ page = page.getNextPage().getOrNull() ?: break
index = 0
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt
index cbde92a0..3630decd 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt
@@ -10,6 +10,7 @@ import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint returns a list of alerts within Orb.
@@ -150,22 +151,22 @@ private constructor(
fun createdAtGt(createdAtGt: OffsetDateTime?) = apply { this.createdAtGt = createdAtGt }
fun createdAtGt(createdAtGt: Optional) =
- createdAtGt(createdAtGt.orElse(null))
+ createdAtGt(createdAtGt.getOrNull())
fun createdAtGte(createdAtGte: OffsetDateTime?) = apply { this.createdAtGte = createdAtGte }
fun createdAtGte(createdAtGte: Optional) =
- createdAtGte(createdAtGte.orElse(null))
+ createdAtGte(createdAtGte.getOrNull())
fun createdAtLt(createdAtLt: OffsetDateTime?) = apply { this.createdAtLt = createdAtLt }
fun createdAtLt(createdAtLt: Optional) =
- createdAtLt(createdAtLt.orElse(null))
+ createdAtLt(createdAtLt.getOrNull())
fun createdAtLte(createdAtLte: OffsetDateTime?) = apply { this.createdAtLte = createdAtLte }
fun createdAtLte(createdAtLte: Optional) =
- createdAtLte(createdAtLte.orElse(null))
+ createdAtLte(createdAtLte.getOrNull())
/**
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
@@ -177,13 +178,13 @@ private constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: Optional) = cursor(cursor.orElse(null))
+ fun cursor(cursor: Optional) = cursor(cursor.getOrNull())
/** Fetch alerts scoped to this customer_id */
fun customerId(customerId: String?) = apply { this.customerId = customerId }
/** Fetch alerts scoped to this customer_id */
- fun customerId(customerId: Optional) = customerId(customerId.orElse(null))
+ fun customerId(customerId: Optional) = customerId(customerId.getOrNull())
/** Fetch alerts scoped to this external_customer_id */
fun externalCustomerId(externalCustomerId: String?) = apply {
@@ -192,7 +193,7 @@ private constructor(
/** Fetch alerts scoped to this external_customer_id */
fun externalCustomerId(externalCustomerId: Optional) =
- externalCustomerId(externalCustomerId.orElse(null))
+ externalCustomerId(externalCustomerId.getOrNull())
/** The number of items to fetch. Defaults to 20. */
fun limit(limit: Long?) = apply { this.limit = limit }
@@ -201,15 +202,14 @@ private constructor(
fun limit(limit: Long) = limit(limit as Long?)
/** The number of items to fetch. Defaults to 20. */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun limit(limit: Optional) = limit(limit.orElse(null) as Long?)
+ fun limit(limit: Optional) = limit(limit.getOrNull())
/** Fetch alerts scoped to this subscription_id */
fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId }
/** Fetch alerts scoped to this subscription_id */
fun subscriptionId(subscriptionId: Optional) =
- subscriptionId(subscriptionId.orElse(null))
+ subscriptionId(subscriptionId.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
index 6e629c90..e5fbce69 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
@@ -19,6 +19,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
@NoAutoDetect
class AmountDiscount
@@ -166,7 +167,7 @@ private constructor(
fun reason(reason: String?) = reason(JsonField.ofNullable(reason))
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
fun reason(reason: JsonField) = apply { this.reason = reason }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
index 39c9ffa4..77e26087 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
@@ -18,6 +18,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* The Metric resource represents a calculation of a quantity based on events. Metrics are defined
@@ -155,7 +156,7 @@ private constructor(
fun description(description: String?) = description(JsonField.ofNullable(description))
- fun description(description: Optional) = description(description.orElse(null))
+ fun description(description: Optional) = description(description.getOrNull())
fun description(description: JsonField) = apply { this.description = description }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
index 51a886f4..51517bb2 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
@@ -215,7 +215,7 @@ private constructor(
* An archived coupon can no longer be redeemed. Active coupons will have a value of null
* for `archived_at`; this field will be non-null for archived coupons.
*/
- fun archivedAt(archivedAt: Optional) = archivedAt(archivedAt.orElse(null))
+ fun archivedAt(archivedAt: Optional) = archivedAt(archivedAt.getOrNull())
/**
* An archived coupon can no longer be redeemed. Active coupons will have a value of null
@@ -250,9 +250,8 @@ private constructor(
* This allows for a coupon's discount to apply for a limited time (determined in months); a
* `null` value here means "unlimited time".
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun durationInMonths(durationInMonths: Optional) =
- durationInMonths(durationInMonths.orElse(null) as Long?)
+ durationInMonths(durationInMonths.getOrNull())
/**
* This allows for a coupon's discount to apply for a limited time (determined in months); a
@@ -279,9 +278,8 @@ private constructor(
* The maximum number of redemptions allowed for this coupon before it is exhausted; `null`
* here means "unlimited".
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun maxRedemptions(maxRedemptions: Optional) =
- maxRedemptions(maxRedemptions.orElse(null) as Long?)
+ maxRedemptions(maxRedemptions.getOrNull())
/**
* The maximum number of redemptions allowed for this coupon before it is exhausted; `null`
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
index 37229820..29b370c5 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
@@ -262,9 +262,8 @@ private constructor(
* This allows for a coupon's discount to apply for a limited time (determined in
* months); a `null` value here means "unlimited time".
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun durationInMonths(durationInMonths: Optional) =
- durationInMonths(durationInMonths.orElse(null) as Long?)
+ durationInMonths(durationInMonths.getOrNull())
/**
* This allows for a coupon's discount to apply for a limited time (determined in
@@ -291,9 +290,8 @@ private constructor(
* The maximum number of redemptions allowed for this coupon before it is
* exhausted;`null` here means "unlimited".
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun maxRedemptions(maxRedemptions: Optional) =
- maxRedemptions(maxRedemptions.orElse(null) as Long?)
+ maxRedemptions(maxRedemptions.getOrNull())
/**
* The maximum number of redemptions allowed for this coupon before it is
@@ -427,9 +425,8 @@ private constructor(
* This allows for a coupon's discount to apply for a limited time (determined in months); a
* `null` value here means "unlimited time".
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun durationInMonths(durationInMonths: Optional) =
- durationInMonths(durationInMonths.orElse(null) as Long?)
+ durationInMonths(durationInMonths.getOrNull())
/**
* This allows for a coupon's discount to apply for a limited time (determined in months); a
@@ -455,9 +452,8 @@ private constructor(
* The maximum number of redemptions allowed for this coupon before it is exhausted;`null`
* here means "unlimited".
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun maxRedemptions(maxRedemptions: Optional) =
- maxRedemptions(maxRedemptions.orElse(null) as Long?)
+ maxRedemptions(maxRedemptions.getOrNull())
/**
* The maximum number of redemptions allowed for this coupon before it is exhausted;`null`
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
index eefa9d40..9b1c9f7d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
@@ -18,6 +18,7 @@ import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint returns a list of all coupons for an account in a list format.
@@ -187,7 +188,7 @@ private constructor(
while (index < page.data().size) {
yield(page.data()[index++])
}
- page = page.getNextPage().orElse(null) ?: break
+ page = page.getNextPage().getOrNull() ?: break
index = 0
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt
index 77b3bfd8..9a5e7ecb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListParams.kt
@@ -8,6 +8,7 @@ import com.withorb.api.core.http.Headers
import com.withorb.api.core.http.QueryParams
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint returns a list of all coupons for an account in a list format.
@@ -98,7 +99,7 @@ private constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: Optional) = cursor(cursor.orElse(null))
+ fun cursor(cursor: Optional) = cursor(cursor.getOrNull())
/** The number of items to fetch. Defaults to 20. */
fun limit(limit: Long?) = apply { this.limit = limit }
@@ -107,15 +108,14 @@ private constructor(
fun limit(limit: Long) = limit(limit as Long?)
/** The number of items to fetch. Defaults to 20. */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun limit(limit: Optional) = limit(limit.orElse(null) as Long?)
+ fun limit(limit: Optional) = limit(limit.getOrNull())
/** Filter to coupons matching this redemption code. */
fun redemptionCode(redemptionCode: String?) = apply { this.redemptionCode = redemptionCode }
/** Filter to coupons matching this redemption code. */
fun redemptionCode(redemptionCode: Optional) =
- redemptionCode(redemptionCode.orElse(null))
+ redemptionCode(redemptionCode.getOrNull())
/**
* Show archived coupons as well (by default, this endpoint only returns active coupons).
@@ -130,9 +130,7 @@ private constructor(
/**
* Show archived coupons as well (by default, this endpoint only returns active coupons).
*/
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun showArchived(showArchived: Optional) =
- showArchived(showArchived.orElse(null) as Boolean?)
+ fun showArchived(showArchived: Optional) = showArchived(showArchived.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
index 7ded38db..5598b914 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
@@ -18,6 +18,7 @@ import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint returns a list of all subscriptions that have redeemed a given coupon as a
@@ -192,7 +193,7 @@ private constructor(
while (index < page.data().size) {
yield(page.data()[index++])
}
- page = page.getNextPage().orElse(null) ?: break
+ page = page.getNextPage().getOrNull() ?: break
index = 0
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt
index 886608b5..edb7fbfd 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListParams.kt
@@ -9,6 +9,7 @@ import com.withorb.api.core.http.Headers
import com.withorb.api.core.http.QueryParams
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint returns a list of all subscriptions that have redeemed a given coupon as a
@@ -103,7 +104,7 @@ private constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: Optional) = cursor(cursor.orElse(null))
+ fun cursor(cursor: Optional) = cursor(cursor.getOrNull())
/** The number of items to fetch. Defaults to 20. */
fun limit(limit: Long?) = apply { this.limit = limit }
@@ -112,8 +113,7 @@ private constructor(
fun limit(limit: Long) = limit(limit as Long?)
/** The number of items to fetch. Defaults to 20. */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun limit(limit: Optional) = limit(limit.orElse(null) as Long?)
+ fun limit(limit: Optional) = limit(limit.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
index 537b0ff8..f3c33545 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
@@ -20,6 +20,7 @@ import com.withorb.api.errors.OrbInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied to
@@ -309,7 +310,7 @@ private constructor(
/** A URL to a PDF of the credit note. */
fun creditNotePdf(creditNotePdf: Optional) =
- creditNotePdf(creditNotePdf.orElse(null))
+ creditNotePdf(creditNotePdf.getOrNull())
/** A URL to a PDF of the credit note. */
fun creditNotePdf(creditNotePdf: JsonField) = apply {
@@ -348,7 +349,7 @@ private constructor(
/** The maximum amount applied on the original invoice */
fun maximumAmountAdjustment(maximumAmountAdjustment: Optional) =
- maximumAmountAdjustment(maximumAmountAdjustment.orElse(null))
+ maximumAmountAdjustment(maximumAmountAdjustment.getOrNull())
/** The maximum amount applied on the original invoice */
fun maximumAmountAdjustment(maximumAmountAdjustment: JsonField) =
@@ -360,7 +361,7 @@ private constructor(
fun memo(memo: String?) = memo(JsonField.ofNullable(memo))
/** An optional memo supplied on the credit note. */
- fun memo(memo: Optional) = memo(memo.orElse(null))
+ fun memo(memo: Optional) = memo(memo.getOrNull())
/** An optional memo supplied on the credit note. */
fun memo(memo: JsonField) = apply { this.memo = memo }
@@ -371,7 +372,7 @@ private constructor(
/** Any credited amount from the applied minimum on the invoice. */
fun minimumAmountRefunded(minimumAmountRefunded: Optional) =
- minimumAmountRefunded(minimumAmountRefunded.orElse(null))
+ minimumAmountRefunded(minimumAmountRefunded.getOrNull())
/** Any credited amount from the applied minimum on the invoice. */
fun minimumAmountRefunded(minimumAmountRefunded: JsonField) = apply {
@@ -380,7 +381,7 @@ private constructor(
fun reason(reason: Reason?) = reason(JsonField.ofNullable(reason))
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
fun reason(reason: JsonField) = apply { this.reason = reason }
@@ -404,7 +405,7 @@ private constructor(
fun voidedAt(voidedAt: OffsetDateTime?) = voidedAt(JsonField.ofNullable(voidedAt))
/** The time at which the credit note was voided in Orb, if applicable. */
- fun voidedAt(voidedAt: Optional) = voidedAt(voidedAt.orElse(null))
+ fun voidedAt(voidedAt: Optional) = voidedAt(voidedAt.getOrNull())
/** The time at which the credit note was voided in Orb, if applicable. */
fun voidedAt(voidedAt: JsonField) = apply { this.voidedAt = voidedAt }
@@ -543,7 +544,7 @@ private constructor(
externalCustomerId(JsonField.ofNullable(externalCustomerId))
fun externalCustomerId(externalCustomerId: Optional) =
- externalCustomerId(externalCustomerId.orElse(null))
+ externalCustomerId(externalCustomerId.getOrNull())
fun externalCustomerId(externalCustomerId: JsonField) = apply {
this.externalCustomerId = externalCustomerId
@@ -777,8 +778,7 @@ private constructor(
fun quantity(quantity: Double) = quantity(quantity as Double?)
/** An optional quantity credited. */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun quantity(quantity: Optional) = quantity(quantity.orElse(null) as Double?)
+ fun quantity(quantity: Optional) = quantity(quantity.getOrNull())
/** An optional quantity credited. */
fun quantity(quantity: JsonField) = apply { this.quantity = quantity }
@@ -966,7 +966,7 @@ private constructor(
/** The tax rate percentage, out of 100. */
fun taxRatePercentage(taxRatePercentage: Optional) =
- taxRatePercentage(taxRatePercentage.orElse(null))
+ taxRatePercentage(taxRatePercentage.getOrNull())
/** The tax rate percentage, out of 100. */
fun taxRatePercentage(taxRatePercentage: JsonField) = apply {
@@ -1198,7 +1198,7 @@ private constructor(
amountDiscount(JsonField.ofNullable(amountDiscount))
fun amountDiscount(amountDiscount: Optional) =
- amountDiscount(amountDiscount.orElse(null))
+ amountDiscount(amountDiscount.getOrNull())
fun amountDiscount(amountDiscount: JsonField) = apply {
this.amountDiscount = amountDiscount
@@ -1206,7 +1206,7 @@ private constructor(
fun reason(reason: String?) = reason(JsonField.ofNullable(reason))
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
fun reason(reason: JsonField) = apply { this.reason = reason }
@@ -1521,7 +1521,7 @@ private constructor(
appliesToPrices(JsonField.ofNullable(appliesToPrices))
fun appliesToPrices(appliesToPrices: Optional>) =
- appliesToPrices(appliesToPrices.orElse(null))
+ appliesToPrices(appliesToPrices.getOrNull())
fun appliesToPrices(appliesToPrices: JsonField>) = apply {
this.appliesToPrices = appliesToPrices.map { it.toMutableList() }
@@ -1536,7 +1536,7 @@ private constructor(
fun reason(reason: String?) = reason(JsonField.ofNullable(reason))
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
fun reason(reason: JsonField) = apply { this.reason = reason }
@@ -2145,7 +2145,7 @@ private constructor(
appliesToPrices(JsonField.ofNullable(appliesToPrices))
fun appliesToPrices(appliesToPrices: Optional>) =
- appliesToPrices(appliesToPrices.orElse(null))
+ appliesToPrices(appliesToPrices.getOrNull())
fun appliesToPrices(appliesToPrices: JsonField>) = apply {
this.appliesToPrices = appliesToPrices.map { it.toMutableList() }
@@ -2160,7 +2160,7 @@ private constructor(
fun reason(reason: String?) = reason(JsonField.ofNullable(reason))
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
fun reason(reason: JsonField) = apply { this.reason = reason }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
index 2c1746f4..196f4647 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
@@ -22,6 +22,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */
class CreditNoteCreateParams
@@ -159,7 +160,7 @@ private constructor(
fun memo(memo: String?) = memo(JsonField.ofNullable(memo))
/** An optional memo to attach to the credit note. */
- fun memo(memo: Optional) = memo(memo.orElse(null))
+ fun memo(memo: Optional) = memo(memo.getOrNull())
/** An optional memo to attach to the credit note. */
fun memo(memo: JsonField) = apply { this.memo = memo }
@@ -168,7 +169,7 @@ private constructor(
fun reason(reason: Reason?) = reason(JsonField.ofNullable(reason))
/** An optional reason for the credit note. */
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
/** An optional reason for the credit note. */
fun reason(reason: JsonField) = apply { this.reason = reason }
@@ -259,7 +260,7 @@ private constructor(
fun memo(memo: String?) = apply { body.memo(memo) }
/** An optional memo to attach to the credit note. */
- fun memo(memo: Optional) = memo(memo.orElse(null))
+ fun memo(memo: Optional) = memo(memo.getOrNull())
/** An optional memo to attach to the credit note. */
fun memo(memo: JsonField) = apply { body.memo(memo) }
@@ -268,7 +269,7 @@ private constructor(
fun reason(reason: Reason?) = apply { body.reason(reason) }
/** An optional reason for the credit note. */
- fun reason(reason: Optional) = reason(reason.orElse(null))
+ fun reason(reason: Optional) = reason(reason.getOrNull())
/** An optional reason for the credit note. */
fun reason(reason: JsonField) = apply { body.reason(reason) }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
index a2d6d101..94ffe97c 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
@@ -18,6 +18,7 @@ import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
+import kotlin.jvm.optionals.getOrNull
/**
* Get a paginated list of CreditNotes. Users can also filter by customer_id, subscription_id, or
@@ -188,7 +189,7 @@ private constructor(
while (index < page.data().size) {
yield(page.data()[index++])
}
- page = page.getNextPage().orElse(null) ?: break
+ page = page.getNextPage().getOrNull() ?: break
index = 0
}
}
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 d7419e76..897ef1b0 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
@@ -8,6 +8,7 @@ import com.withorb.api.core.http.Headers
import com.withorb.api.core.http.QueryParams
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* Get a paginated list of CreditNotes. Users can also filter by customer_id, subscription_id, or
@@ -82,7 +83,7 @@ private constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: Optional) = cursor(cursor.orElse(null))
+ fun cursor(cursor: Optional) = cursor(cursor.getOrNull())
/** The number of items to fetch. Defaults to 20. */
fun limit(limit: Long?) = apply { this.limit = limit }
@@ -91,8 +92,7 @@ private constructor(
fun limit(limit: Long) = limit(limit as Long?)
/** The number of items to fetch. Defaults to 20. */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun limit(limit: Optional) = limit(limit.orElse(null) as Long?)
+ fun limit(limit: Optional) = limit(limit.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
index c73b8de4..691b833c 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
@@ -20,6 +20,7 @@ import com.withorb.api.errors.OrbInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* A customer is a buyer of your products, and the other party to the billing relationship.
@@ -659,7 +660,7 @@ private constructor(
billingAddress(JsonField.ofNullable(billingAddress))
fun billingAddress(billingAddress: Optional) =
- billingAddress(billingAddress.orElse(null))
+ billingAddress(billingAddress.getOrNull())
fun billingAddress(billingAddress: JsonField) = apply {
this.billingAddress = billingAddress
@@ -671,7 +672,7 @@ private constructor(
fun currency(currency: String?) = currency(JsonField.ofNullable(currency))
- fun currency(currency: Optional) = currency(currency.orElse(null))
+ fun currency(currency: Optional) = currency(currency.getOrNull())
fun currency(currency: JsonField) = apply { this.currency = currency }
@@ -699,9 +700,8 @@ private constructor(
fun exemptFromAutomatedTax(exemptFromAutomatedTax: Boolean) =
exemptFromAutomatedTax(exemptFromAutomatedTax as Boolean?)
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
fun exemptFromAutomatedTax(exemptFromAutomatedTax: Optional) =
- exemptFromAutomatedTax(exemptFromAutomatedTax.orElse(null) as Boolean?)
+ exemptFromAutomatedTax(exemptFromAutomatedTax.getOrNull())
fun exemptFromAutomatedTax(exemptFromAutomatedTax: JsonField) = apply {
this.exemptFromAutomatedTax = exemptFromAutomatedTax
@@ -721,7 +721,7 @@ private constructor(
* in your system.
*/
fun externalCustomerId(externalCustomerId: Optional) =
- externalCustomerId(externalCustomerId.orElse(null))
+ externalCustomerId(externalCustomerId.getOrNull())
/**
* An optional user-defined ID for this customer resource, used throughout the system as an
@@ -770,7 +770,7 @@ private constructor(
* test mode, the connection must first be configured in the Orb webapp.
*/
fun paymentProvider(paymentProvider: Optional) =
- paymentProvider(paymentProvider.orElse(null))
+ paymentProvider(paymentProvider.getOrNull())
/**
* This is used for creating charges or invoices in an external system via Orb. When not in
@@ -792,7 +792,7 @@ private constructor(
* for creating charges or invoices in the external system via Orb.
*/
fun paymentProviderId(paymentProviderId: Optional) =
- paymentProviderId(paymentProviderId.orElse(null))
+ paymentProviderId(paymentProviderId.getOrNull())
/**
* The ID of this customer in an external payments solution, such as Stripe. This is used
@@ -804,7 +804,7 @@ private constructor(
fun portalUrl(portalUrl: String?) = portalUrl(JsonField.ofNullable(portalUrl))
- fun portalUrl(portalUrl: Optional) = portalUrl(portalUrl.orElse(null))
+ fun portalUrl(portalUrl: Optional) = portalUrl(portalUrl.getOrNull())
fun portalUrl(portalUrl: JsonField) = apply { this.portalUrl = portalUrl }
@@ -812,7 +812,7 @@ private constructor(
shippingAddress(JsonField.ofNullable(shippingAddress))
fun shippingAddress(shippingAddress: Optional) =
- shippingAddress(shippingAddress.orElse(null))
+ shippingAddress(shippingAddress.getOrNull())
fun shippingAddress(shippingAddress: JsonField) = apply {
this.shippingAddress = shippingAddress
@@ -1032,7 +1032,7 @@ private constructor(
* |Venezuela |`ve_rif` |Venezuelan RIF Number |
* |Vietnam |`vn_tin` |Vietnamese Tax ID Number |
*/
- fun taxId(taxId: Optional) = taxId(taxId.orElse(null))
+ fun taxId(taxId: Optional) = taxId(taxId.getOrNull())
/**
* Tax IDs are commonly required to be displayed on customer invoices, which are added to
@@ -1161,7 +1161,7 @@ private constructor(
fun accountingSyncConfiguration(
accountingSyncConfiguration: Optional
- ) = accountingSyncConfiguration(accountingSyncConfiguration.orElse(null))
+ ) = accountingSyncConfiguration(accountingSyncConfiguration.getOrNull())
fun accountingSyncConfiguration(
accountingSyncConfiguration: JsonField
@@ -1171,7 +1171,7 @@ private constructor(
reportingConfiguration(JsonField.ofNullable(reportingConfiguration))
fun reportingConfiguration(reportingConfiguration: Optional) =
- reportingConfiguration(reportingConfiguration.orElse(null))
+ reportingConfiguration(reportingConfiguration.getOrNull())
fun reportingConfiguration(reportingConfiguration: JsonField) =
apply {
@@ -1342,37 +1342,37 @@ private constructor(
fun city(city: String?) = city(JsonField.ofNullable(city))
- fun city(city: Optional) = city(city.orElse(null))
+ fun city(city: Optional) = city(city.getOrNull())
fun city(city: JsonField) = apply { this.city = city }
fun country(country: String?) = country(JsonField.ofNullable(country))
- fun country(country: Optional) = country(country.orElse(null))
+ fun country(country: Optional) = country(country.getOrNull())
fun country(country: JsonField) = apply { this.country = country }
fun line1(line1: String?) = line1(JsonField.ofNullable(line1))
- fun line1(line1: Optional) = line1(line1.orElse(null))
+ fun line1(line1: Optional) = line1(line1.getOrNull())
fun line1(line1: JsonField) = apply { this.line1 = line1 }
fun line2(line2: String?) = line2(JsonField.ofNullable(line2))
- fun line2(line2: Optional) = line2(line2.orElse(null))
+ fun line2(line2: Optional) = line2(line2.getOrNull())
fun line2(line2: JsonField) = apply { this.line2 = line2 }
fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode))
- fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null))
+ fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull())
fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode }
fun state(state: String?) = state(JsonField.ofNullable(state))
- fun state(state: Optional) = state(state.orElse(null))
+ fun state(state: Optional) = state(state.getOrNull())
fun state(state: JsonField) = apply { this.state = state }
@@ -1509,7 +1509,7 @@ private constructor(
fun parent(parent: Parent?) = parent(JsonField.ofNullable(parent))
- fun parent(parent: Optional) = parent(parent.orElse(null))
+ fun parent(parent: Optional) = parent(parent.getOrNull())
fun parent(parent: JsonField) = apply { this.parent = parent }
@@ -1619,7 +1619,7 @@ private constructor(
externalCustomerId(JsonField.ofNullable(externalCustomerId))
fun externalCustomerId(externalCustomerId: Optional) =
- externalCustomerId(externalCustomerId.orElse(null))
+ externalCustomerId(externalCustomerId.getOrNull())
fun externalCustomerId(externalCustomerId: JsonField) = apply {
this.externalCustomerId = externalCustomerId
@@ -1752,7 +1752,7 @@ private constructor(
externalCustomerId(JsonField.ofNullable(externalCustomerId))
fun externalCustomerId(externalCustomerId: Optional) =
- externalCustomerId(externalCustomerId.orElse(null))
+ externalCustomerId(externalCustomerId.getOrNull())
fun externalCustomerId(externalCustomerId: JsonField) = apply {
this.externalCustomerId = externalCustomerId
@@ -2148,37 +2148,37 @@ private constructor(
fun city(city: String?) = city(JsonField.ofNullable(city))
- fun city(city: Optional) = city(city.orElse(null))
+ fun city(city: Optional) = city(city.getOrNull())
fun city(city: JsonField) = apply { this.city = city }
fun country(country: String?) = country(JsonField.ofNullable(country))
- fun country(country: Optional) = country(country.orElse(null))
+ fun country(country: Optional) = country(country.getOrNull())
fun country(country: JsonField) = apply { this.country = country }
fun line1(line1: String?) = line1(JsonField.ofNullable(line1))
- fun line1(line1: Optional) = line1(line1.orElse(null))
+ fun line1(line1: Optional) = line1(line1.getOrNull())
fun line1(line1: JsonField) = apply { this.line1 = line1 }
fun line2(line2: String?) = line2(JsonField.ofNullable(line2))
- fun line2(line2: Optional) = line2(line2.orElse(null))
+ fun line2(line2: Optional) = line2(line2.getOrNull())
fun line2(line2: JsonField) = apply { this.line2 = line2 }
fun postalCode(postalCode: String?) = postalCode(JsonField.ofNullable(postalCode))
- fun postalCode(postalCode: Optional) = postalCode(postalCode.orElse(null))
+ fun postalCode(postalCode: Optional) = postalCode(postalCode.getOrNull())
fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode }
fun state(state: String?) = state(JsonField.ofNullable(state))
- fun state(state: Optional) = state(state.orElse(null))
+ fun state(state: Optional) = state(state.getOrNull())
fun state(state: JsonField) = apply { this.state = state }
@@ -3740,7 +3740,7 @@ private constructor(
externalProviderId(JsonField.ofNullable(externalProviderId))
fun externalProviderId(externalProviderId: Optional) =
- externalProviderId(externalProviderId.orElse(null))
+ externalProviderId(externalProviderId.getOrNull())
fun externalProviderId(externalProviderId: JsonField) = apply {
this.externalProviderId = externalProviderId
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
index 706a9065..565374d7 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
@@ -21,6 +21,7 @@ import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* Creates an immutable balance transaction that updates the customer's balance and returns back the
@@ -162,7 +163,7 @@ private constructor(
fun description(description: String?) = description(JsonField.ofNullable(description))
/** An optional description that can be specified around this entry. */
- fun description(description: Optional) = description(description.orElse(null))
+ fun description(description: Optional) = description(description.getOrNull())
/** An optional description that can be specified around this entry. */
fun description(description: JsonField) = apply {
@@ -267,7 +268,7 @@ private constructor(
fun description(description: String?) = apply { body.description(description) }
/** An optional description that can be specified around this entry. */
- fun description(description: Optional) = description(description.orElse(null))
+ fun description(description: Optional) = description(description.getOrNull())
/** An optional description that can be specified around this entry. */
fun description(description: JsonField) = apply { body.description(description) }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
index ee695479..31b40c60 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
@@ -19,6 +19,7 @@ import com.withorb.api.errors.OrbInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
@NoAutoDetect
class CustomerBalanceTransactionCreateResponse
@@ -231,7 +232,7 @@ private constructor(
fun creditNote(creditNote: CreditNote?) = creditNote(JsonField.ofNullable(creditNote))
- fun creditNote(creditNote: Optional) = creditNote(creditNote.orElse(null))
+ fun creditNote(creditNote: Optional) = creditNote(creditNote.getOrNull())
fun creditNote(creditNote: JsonField) = apply { this.creditNote = creditNote }
@@ -239,7 +240,7 @@ private constructor(
fun description(description: String?) = description(JsonField.ofNullable(description))
/** An optional description provided for manual customer balance adjustments. */
- fun description(description: Optional) = description(description.orElse(null))
+ fun description(description: Optional) = description(description.getOrNull())
/** An optional description provided for manual customer balance adjustments. */
fun description(description: JsonField) = apply { this.description = description }
@@ -260,7 +261,7 @@ private constructor(
fun invoice(invoice: Invoice?) = invoice(JsonField.ofNullable(invoice))
- fun invoice(invoice: Optional) = invoice(invoice.orElse(null))
+ fun invoice(invoice: Optional) = invoice(invoice.getOrNull())
fun invoice(invoice: JsonField) = apply { this.invoice = invoice }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
index f15d0e6e..ec5e0a70 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
@@ -18,6 +18,7 @@ import java.util.Objects
import java.util.Optional
import java.util.stream.Stream
import java.util.stream.StreamSupport
+import kotlin.jvm.optionals.getOrNull
/**
* ## The customer balance
@@ -220,7 +221,7 @@ private constructor(
while (index < page.data().size) {
yield(page.data()[index++])
}
- page = page.getNextPage().orElse(null) ?: break
+ page = page.getNextPage().getOrNull() ?: break
index = 0
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt
index 90c577f7..c1f51227 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt
@@ -11,6 +11,7 @@ import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* ## The customer balance
@@ -173,7 +174,7 @@ private constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: Optional) = cursor(cursor.orElse(null))
+ fun cursor(cursor: Optional) = cursor(cursor.getOrNull())
/** The number of items to fetch. Defaults to 20. */
fun limit(limit: Long?) = apply { this.limit = limit }
@@ -182,36 +183,35 @@ private constructor(
fun limit(limit: Long) = limit(limit as Long?)
/** The number of items to fetch. Defaults to 20. */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun limit(limit: Optional) = limit(limit.orElse(null) as Long?)
+ fun limit(limit: Optional) = limit(limit.getOrNull())
fun operationTimeGt(operationTimeGt: OffsetDateTime?) = apply {
this.operationTimeGt = operationTimeGt
}
fun operationTimeGt(operationTimeGt: Optional) =
- operationTimeGt(operationTimeGt.orElse(null))
+ operationTimeGt(operationTimeGt.getOrNull())
fun operationTimeGte(operationTimeGte: OffsetDateTime?) = apply {
this.operationTimeGte = operationTimeGte
}
fun operationTimeGte(operationTimeGte: Optional) =
- operationTimeGte(operationTimeGte.orElse(null))
+ operationTimeGte(operationTimeGte.getOrNull())
fun operationTimeLt(operationTimeLt: OffsetDateTime?) = apply {
this.operationTimeLt = operationTimeLt
}
fun operationTimeLt(operationTimeLt: Optional) =
- operationTimeLt(operationTimeLt.orElse(null))
+ operationTimeLt(operationTimeLt.getOrNull())
fun operationTimeLte(operationTimeLte: OffsetDateTime?) = apply {
this.operationTimeLte = operationTimeLte
}
fun operationTimeLte(operationTimeLte: Optional) =
- operationTimeLte(operationTimeLte.orElse(null))
+ operationTimeLte(operationTimeLte.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
index a392db06..89340e68 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
@@ -19,6 +19,7 @@ import com.withorb.api.errors.OrbInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
@NoAutoDetect
class CustomerBalanceTransactionListResponse
@@ -231,7 +232,7 @@ private constructor(
fun creditNote(creditNote: CreditNote?) = creditNote(JsonField.ofNullable(creditNote))
- fun creditNote(creditNote: Optional) = creditNote(creditNote.orElse(null))
+ fun creditNote(creditNote: Optional) = creditNote(creditNote.getOrNull())
fun creditNote(creditNote: JsonField) = apply { this.creditNote = creditNote }
@@ -239,7 +240,7 @@ private constructor(
fun description(description: String?) = description(JsonField.ofNullable(description))
/** An optional description provided for manual customer balance adjustments. */
- fun description(description: Optional) = description(description.orElse(null))
+ fun description(description: Optional) = description(description.getOrNull())
/** An optional description provided for manual customer balance adjustments. */
fun description(description: JsonField) = apply { this.description = description }
@@ -260,7 +261,7 @@ private constructor(
fun invoice(invoice: Invoice?) = invoice(JsonField.ofNullable(invoice))
- fun invoice(invoice: Optional) = invoice(invoice.orElse(null))
+ fun invoice(invoice: Optional) = invoice(invoice.getOrNull())
fun invoice(invoice: JsonField) = apply { this.invoice = invoice }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
index 273d0c48..4024f0a2 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
@@ -15,6 +15,7 @@ import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* This endpoint is used to fetch a day-by-day snapshot of a customer's costs in Orb, calculated by
@@ -235,14 +236,14 @@ private constructor(
fun currency(currency: String?) = apply { this.currency = currency }
/** The currency or custom pricing unit to use. */
- fun currency(currency: Optional) = currency(currency.orElse(null))
+ fun currency(currency: Optional) = currency(currency.getOrNull())
/** Costs returned are exclusive of `timeframe_end`. */
fun timeframeEnd(timeframeEnd: OffsetDateTime?) = apply { this.timeframeEnd = timeframeEnd }
/** Costs returned are exclusive of `timeframe_end`. */
fun timeframeEnd(timeframeEnd: Optional) =
- timeframeEnd(timeframeEnd.orElse(null))
+ timeframeEnd(timeframeEnd.getOrNull())
/** Costs returned are inclusive of `timeframe_start`. */
fun timeframeStart(timeframeStart: OffsetDateTime?) = apply {
@@ -251,7 +252,7 @@ private constructor(
/** Costs returned are inclusive of `timeframe_start`. */
fun timeframeStart(timeframeStart: Optional) =
- timeframeStart(timeframeStart.orElse(null))
+ timeframeStart(timeframeStart.getOrNull())
/**
* Controls whether Orb returns cumulative costs since the start of the billing period, or
@@ -265,7 +266,7 @@ private constructor(
* incremental day-by-day costs. If your customer has minimums or discounts, it's strongly
* recommended that you use the default cumulative behavior.
*/
- fun viewMode(viewMode: Optional) = viewMode(viewMode.orElse(null))
+ fun viewMode(viewMode: Optional) = viewMode(viewMode.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
index d569c8fe..b3848c3f 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
@@ -18,6 +18,7 @@ import com.withorb.api.core.toImmutable
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
@NoAutoDetect
class CustomerCostListByExternalIdResponse
@@ -550,9 +551,7 @@ private constructor(
fun quantity(quantity: Double) = quantity(quantity as Double?)
/** The price's quantity for the timeframe */
- @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
- fun quantity(quantity: Optional) =
- quantity(quantity.orElse(null) as Double?)
+ fun quantity(quantity: Optional