diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 4ad3fef3..e7562934 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.18.0"
+ ".": "0.19.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index c4326132..7dd05a09 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 101
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-b6d60f8edbdc94e65f06b0b002cc8e1f27aceccc67917bea849425701ba82fb8.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-52bd3046e73f201c4d08edfa92756791c015be907691a7893f8e7782cc2aea6f.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ea7cb79..c16b34ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 0.19.0 (2025-01-06)
+
+Full Changelog: [v0.18.0...v0.19.0](https://github.com/orbcorp/orb-java/compare/v0.18.0...v0.19.0)
+
+### Features
+
+* **api:** api update ([#180](https://github.com/orbcorp/orb-java/issues/180)) ([4aa16b5](https://github.com/orbcorp/orb-java/commit/4aa16b536e853fd276832e491ad9b9ad94b42cf1))
+* **client:** allow passing null or optional for nullable fields ([#179](https://github.com/orbcorp/orb-java/issues/179)) ([1797a16](https://github.com/orbcorp/orb-java/commit/1797a16f486fefa201684321d07897d5b5b0937e))
+
+
+### Styles
+
+* **internal:** sort fields ([#177](https://github.com/orbcorp/orb-java/issues/177)) ([3313c08](https://github.com/orbcorp/orb-java/commit/3313c085e6c200cae6212b783d92ae731cbc786d))
+
## 0.18.0 (2025-01-06)
Full Changelog: [v0.17.0...v0.18.0](https://github.com/orbcorp/orb-java/compare/v0.17.0...v0.18.0)
diff --git a/README.md b/README.md
index 02ce69eb..6654207a 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.18.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.19.0)
@@ -25,7 +25,7 @@ The REST API documentation can be foundĀ on [docs.withorb.com](https://docs.with
```kotlin
-implementation("com.withorb.api:orb-java:0.18.0")
+implementation("com.withorb.api:orb-java:0.19.0")
```
#### Maven
@@ -34,7 +34,7 @@ implementation("com.withorb.api:orb-java:0.18.0")
com.withorb.api
orb-java
- 0.18.0
+ 0.19.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 42210ec6..64a0a083 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,7 +4,7 @@ plugins {
allprojects {
group = "com.withorb.api"
- version = "0.18.0" // x-release-please-version
+ version = "0.19.0" // x-release-please-version
}
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 61da295b..70382242 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
@@ -11,6 +11,7 @@ import com.withorb.api.core.http.QueryParams
import java.net.Proxy
import java.time.Clock
import java.time.Duration
+import java.util.Optional
class OrbOkHttpClient private constructor() {
@@ -130,10 +131,13 @@ class OrbOkHttpClient private constructor() {
fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }
- fun webhookSecret(webhookSecret: String) = apply {
+ fun webhookSecret(webhookSecret: String?) = apply {
clientOptions.webhookSecret(webhookSecret)
}
+ fun webhookSecret(webhookSecret: Optional) =
+ webhookSecret(webhookSecret.orElse(null))
+
fun fromEnv() = apply { clientOptions.fromEnv() }
fun build(): OrbClient =
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 7ccb5cea..36e46218 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
@@ -11,6 +11,7 @@ import com.withorb.api.core.http.QueryParams
import java.net.Proxy
import java.time.Clock
import java.time.Duration
+import java.util.Optional
class OrbOkHttpClientAsync private constructor() {
@@ -130,10 +131,13 @@ class OrbOkHttpClientAsync private constructor() {
fun apiKey(apiKey: String) = apply { clientOptions.apiKey(apiKey) }
- fun webhookSecret(webhookSecret: String) = apply {
+ fun webhookSecret(webhookSecret: String?) = apply {
clientOptions.webhookSecret(webhookSecret)
}
+ fun webhookSecret(webhookSecret: Optional) =
+ webhookSecret(webhookSecret.orElse(null))
+
fun fromEnv() = apply { clientOptions.fromEnv() }
fun build(): OrbClientAsync =
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 31d980e0..39bcc89e 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
@@ -9,6 +9,7 @@ import com.withorb.api.core.http.PhantomReachableClosingHttpClient
import com.withorb.api.core.http.QueryParams
import com.withorb.api.core.http.RetryingHttpClient
import java.time.Clock
+import java.util.Optional
class ClientOptions
private constructor(
@@ -159,7 +160,10 @@ private constructor(
fun apiKey(apiKey: String) = apply { this.apiKey = apiKey }
- fun webhookSecret(webhookSecret: String) = apply { this.webhookSecret = webhookSecret }
+ fun webhookSecret(webhookSecret: String?) = apply { this.webhookSecret = webhookSecret }
+
+ fun webhookSecret(webhookSecret: Optional) =
+ webhookSecret(webhookSecret.orElse(null))
fun fromEnv() = apply {
System.getenv("ORB_API_KEY")?.let { apiKey(it) }
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 d79be632..04d2bcbd 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
@@ -30,51 +30,50 @@ class Alert
@JsonCreator
private constructor(
@JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(),
- @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(),
@JsonProperty("created_at")
@ExcludeMissing
private val createdAt: JsonField = JsonMissing.of(),
- @JsonProperty("enabled")
- @ExcludeMissing
- private val enabled: JsonField = JsonMissing.of(),
- @JsonProperty("thresholds")
+ @JsonProperty("currency")
@ExcludeMissing
- private val thresholds: JsonField> = JsonMissing.of(),
+ private val currency: JsonField = JsonMissing.of(),
@JsonProperty("customer")
@ExcludeMissing
private val customer: JsonField = JsonMissing.of(),
- @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(),
- @JsonProperty("subscription")
+ @JsonProperty("enabled")
@ExcludeMissing
- private val subscription: JsonField = JsonMissing.of(),
+ private val enabled: JsonField = JsonMissing.of(),
@JsonProperty("metric")
@ExcludeMissing
private val metric: JsonField = JsonMissing.of(),
- @JsonProperty("currency")
+ @JsonProperty("plan") @ExcludeMissing private val plan: JsonField = JsonMissing.of(),
+ @JsonProperty("subscription")
@ExcludeMissing
- private val currency: JsonField = JsonMissing.of(),
+ private val subscription: JsonField = JsonMissing.of(),
+ @JsonProperty("thresholds")
+ @ExcludeMissing
+ private val thresholds: JsonField> = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(),
) {
/** Also referred to as alert_id in this documentation. */
fun id(): String = id.getRequired("id")
- /** The type of alert. This must be a valid alert type. */
- fun type(): Type = type.getRequired("type")
-
/** The creation time of the resource in Orb. */
fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")
- /** Whether the alert is enabled or disabled. */
- fun enabled(): Boolean = enabled.getRequired("enabled")
-
- /** The thresholds that define the conditions under which the alert will be triggered. */
- fun thresholds(): Optional> =
- Optional.ofNullable(thresholds.getNullable("thresholds"))
+ /** The name of the currency the credit balance or invoice cost is denominated in. */
+ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency"))
/** The customer the alert applies to. */
fun customer(): Optional = Optional.ofNullable(customer.getNullable("customer"))
+ /** Whether the alert is enabled or disabled. */
+ fun enabled(): Boolean = enabled.getRequired("enabled")
+
+ /** The metric the alert applies to. */
+ fun metric(): Optional = Optional.ofNullable(metric.getNullable("metric"))
+
/** The plan the alert applies to. */
fun plan(): Optional = Optional.ofNullable(plan.getNullable("plan"))
@@ -82,41 +81,42 @@ private constructor(
fun subscription(): Optional =
Optional.ofNullable(subscription.getNullable("subscription"))
- /** The metric the alert applies to. */
- fun metric(): Optional = Optional.ofNullable(metric.getNullable("metric"))
+ /** The thresholds that define the conditions under which the alert will be triggered. */
+ fun thresholds(): Optional> =
+ Optional.ofNullable(thresholds.getNullable("thresholds"))
- /** The name of the currency the credit balance or invoice cost is denominated in. */
- fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency"))
+ /** The type of alert. This must be a valid alert type. */
+ fun type(): Type = type.getRequired("type")
/** Also referred to as alert_id in this documentation. */
@JsonProperty("id") @ExcludeMissing fun _id() = id
- /** The type of alert. This must be a valid alert type. */
- @JsonProperty("type") @ExcludeMissing fun _type() = type
-
/** The creation time of the resource in Orb. */
@JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt
- /** Whether the alert is enabled or disabled. */
- @JsonProperty("enabled") @ExcludeMissing fun _enabled() = enabled
-
- /** The thresholds that define the conditions under which the alert will be triggered. */
- @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds
+ /** The name of the currency the credit balance or invoice cost is denominated in. */
+ @JsonProperty("currency") @ExcludeMissing fun _currency() = currency
/** The customer the alert applies to. */
@JsonProperty("customer") @ExcludeMissing fun _customer() = customer
+ /** Whether the alert is enabled or disabled. */
+ @JsonProperty("enabled") @ExcludeMissing fun _enabled() = enabled
+
+ /** The metric the alert applies to. */
+ @JsonProperty("metric") @ExcludeMissing fun _metric() = metric
+
/** The plan the alert applies to. */
@JsonProperty("plan") @ExcludeMissing fun _plan() = plan
/** The subscription the alert applies to. */
@JsonProperty("subscription") @ExcludeMissing fun _subscription() = subscription
- /** The metric the alert applies to. */
- @JsonProperty("metric") @ExcludeMissing fun _metric() = metric
+ /** The thresholds that define the conditions under which the alert will be triggered. */
+ @JsonProperty("thresholds") @ExcludeMissing fun _thresholds() = thresholds
- /** The name of the currency the credit balance or invoice cost is denominated in. */
- @JsonProperty("currency") @ExcludeMissing fun _currency() = currency
+ /** The type of alert. This must be a valid alert type. */
+ @JsonProperty("type") @ExcludeMissing fun _type() = type
@JsonAnyGetter
@ExcludeMissing
@@ -127,15 +127,15 @@ private constructor(
fun validate(): Alert = apply {
if (!validated) {
id()
- type()
createdAt()
- enabled()
- thresholds().map { it.forEach { it.validate() } }
+ currency()
customer().map { it.validate() }
+ enabled()
+ metric().map { it.validate() }
plan().map { it.validate() }
subscription().map { it.validate() }
- metric().map { it.validate() }
- currency()
+ thresholds().map { it.forEach { it.validate() } }
+ type()
validated = true
}
}
@@ -150,29 +150,29 @@ private constructor(
class Builder {
private var id: JsonField = JsonMissing.of()
- private var type: JsonField = JsonMissing.of()
private var createdAt: JsonField = JsonMissing.of()
- private var enabled: JsonField = JsonMissing.of()
- private var thresholds: JsonField> = JsonMissing.of()
+ private var currency: JsonField = JsonMissing.of()
private var customer: JsonField = JsonMissing.of()
+ private var enabled: JsonField = JsonMissing.of()
+ private var metric: JsonField = JsonMissing.of()
private var plan: JsonField = JsonMissing.of()
private var subscription: JsonField = JsonMissing.of()
- private var metric: JsonField = JsonMissing.of()
- private var currency: JsonField = JsonMissing.of()
+ private var thresholds: JsonField> = JsonMissing.of()
+ private var type: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(alert: Alert) = apply {
id = alert.id
- type = alert.type
createdAt = alert.createdAt
- enabled = alert.enabled
- thresholds = alert.thresholds
+ currency = alert.currency
customer = alert.customer
+ enabled = alert.enabled
+ metric = alert.metric
plan = alert.plan
subscription = alert.subscription
- metric = alert.metric
- currency = alert.currency
+ thresholds = alert.thresholds
+ type = alert.type
additionalProperties = alert.additionalProperties.toMutableMap()
}
@@ -182,31 +182,17 @@ private constructor(
/** Also referred to as alert_id in this documentation. */
fun id(id: JsonField) = apply { this.id = id }
- /** The type of alert. This must be a valid alert type. */
- fun type(type: Type) = type(JsonField.of(type))
-
- /** The type of alert. This must be a valid alert type. */
- fun type(type: JsonField) = apply { this.type = type }
-
/** The creation time of the resource in Orb. */
fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))
/** The creation time of the resource in Orb. */
fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
- /** Whether the alert is enabled or disabled. */
- fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled))
-
- /** Whether the alert is enabled or disabled. */
- fun enabled(enabled: JsonField) = apply { this.enabled = enabled }
-
- /** The thresholds that define the conditions under which the alert will be triggered. */
- fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds))
+ /** The name of the currency the credit balance or invoice cost is denominated in. */
+ fun currency(currency: String) = currency(JsonField.of(currency))
- /** The thresholds that define the conditions under which the alert will be triggered. */
- fun thresholds(thresholds: JsonField>) = apply {
- this.thresholds = thresholds
- }
+ /** The name of the currency the credit balance or invoice cost is denominated in. */
+ fun currency(currency: JsonField) = apply { this.currency = currency }
/** The customer the alert applies to. */
fun customer(customer: Customer) = customer(JsonField.of(customer))
@@ -214,6 +200,18 @@ private constructor(
/** The customer the alert applies to. */
fun customer(customer: JsonField) = apply { this.customer = customer }
+ /** Whether the alert is enabled or disabled. */
+ fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled))
+
+ /** Whether the alert is enabled or disabled. */
+ fun enabled(enabled: JsonField) = apply { this.enabled = enabled }
+
+ /** The metric the alert applies to. */
+ fun metric(metric: Metric) = metric(JsonField.of(metric))
+
+ /** The metric the alert applies to. */
+ fun metric(metric: JsonField) = apply { this.metric = metric }
+
/** The plan the alert applies to. */
fun plan(plan: Plan) = plan(JsonField.of(plan))
@@ -228,17 +226,19 @@ private constructor(
this.subscription = subscription
}
- /** The metric the alert applies to. */
- fun metric(metric: Metric) = metric(JsonField.of(metric))
+ /** The thresholds that define the conditions under which the alert will be triggered. */
+ fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds))
- /** The metric the alert applies to. */
- fun metric(metric: JsonField) = apply { this.metric = metric }
+ /** The thresholds that define the conditions under which the alert will be triggered. */
+ fun thresholds(thresholds: JsonField>) = apply {
+ this.thresholds = thresholds
+ }
- /** The name of the currency the credit balance or invoice cost is denominated in. */
- fun currency(currency: String) = currency(JsonField.of(currency))
+ /** The type of alert. This must be a valid alert type. */
+ fun type(type: Type) = type(JsonField.of(type))
- /** The name of the currency the credit balance or invoice cost is denominated in. */
- fun currency(currency: JsonField) = apply { this.currency = currency }
+ /** The type of alert. This must be a valid alert type. */
+ fun type(type: JsonField) = apply { this.type = type }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -262,15 +262,15 @@ private constructor(
fun build(): Alert =
Alert(
id,
- type,
createdAt,
- enabled,
- thresholds.map { it.toImmutable() },
+ currency,
customer,
+ enabled,
+ metric,
plan,
subscription,
- metric,
- currency,
+ thresholds.map { it.toImmutable() },
+ type,
additionalProperties.toImmutable(),
)
}
@@ -920,15 +920,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is Alert && id == other.id && type == other.type && createdAt == other.createdAt && enabled == other.enabled && thresholds == other.thresholds && customer == other.customer && plan == other.plan && subscription == other.subscription && metric == other.metric && currency == other.currency && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Alert && id == other.id && createdAt == other.createdAt && currency == other.currency && customer == other.customer && enabled == other.enabled && metric == other.metric && plan == other.plan && subscription == other.subscription && thresholds == other.thresholds && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, type, createdAt, enabled, thresholds, customer, plan, subscription, metric, currency, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, createdAt, currency, customer, enabled, metric, plan, subscription, thresholds, type, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "Alert{id=$id, type=$type, createdAt=$createdAt, enabled=$enabled, thresholds=$thresholds, customer=$customer, plan=$plan, subscription=$subscription, metric=$metric, currency=$currency, additionalProperties=$additionalProperties}"
+ "Alert{id=$id, createdAt=$createdAt, currency=$currency, customer=$customer, enabled=$enabled, metric=$metric, plan=$plan, subscription=$subscription, thresholds=$thresholds, type=$type, additionalProperties=$additionalProperties}"
}
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 33e110b3..1e152e87 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
@@ -112,10 +112,14 @@ constructor(
fun type(type: Type) = apply { this.type = type }
/** The thresholds that define the values at which the alert will be triggered. */
- fun thresholds(thresholds: List) = apply {
- this.thresholds = thresholds.toMutableList()
+ fun thresholds(thresholds: List?) = apply {
+ this.thresholds = thresholds?.toMutableList()
}
+ /** The thresholds that define the values at which the alert will be triggered. */
+ fun thresholds(thresholds: Optional>) =
+ thresholds(thresholds.orElse(null))
+
/** The thresholds that define the values at which the alert will be triggered. */
fun addThreshold(threshold: Threshold) = apply {
thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) }
@@ -199,7 +203,10 @@ constructor(
fun type(type: Type) = apply { body.type(type) }
/** The thresholds that define the values at which the alert will be triggered. */
- fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) }
+ 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))
/** The thresholds that define the values at which the alert will be triggered. */
fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) }
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 41d2f297..5c144763 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
@@ -114,10 +114,14 @@ constructor(
fun type(type: Type) = apply { this.type = type }
/** The thresholds that define the values at which the alert will be triggered. */
- fun thresholds(thresholds: List) = apply {
- this.thresholds = thresholds.toMutableList()
+ fun thresholds(thresholds: List?) = apply {
+ this.thresholds = thresholds?.toMutableList()
}
+ /** The thresholds that define the values at which the alert will be triggered. */
+ fun thresholds(thresholds: Optional>) =
+ thresholds(thresholds.orElse(null))
+
/** The thresholds that define the values at which the alert will be triggered. */
fun addThreshold(threshold: Threshold) = apply {
thresholds = (thresholds ?: mutableListOf()).apply { add(threshold) }
@@ -207,7 +211,10 @@ constructor(
fun type(type: Type) = apply { body.type(type) }
/** The thresholds that define the values at which the alert will be triggered. */
- fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) }
+ 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))
/** The thresholds that define the values at which the alert will be triggered. */
fun addThreshold(threshold: Threshold) = apply { body.addThreshold(threshold) }
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 5287c3aa..daa10ea4 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
@@ -119,7 +119,10 @@ constructor(
fun type(type: Type) = apply { this.type = type }
/** The metric to track usage for. */
- fun metricId(metricId: String) = apply { this.metricId = metricId }
+ fun metricId(metricId: String?) = apply { this.metricId = metricId }
+
+ /** The metric to track usage for. */
+ fun metricId(metricId: Optional) = metricId(metricId.orElse(null))
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -206,7 +209,10 @@ constructor(
fun type(type: Type) = apply { body.type(type) }
/** The metric to track usage for. */
- fun metricId(metricId: String) = apply { body.metricId(metricId) }
+ fun metricId(metricId: String?) = apply { body.metricId(metricId) }
+
+ /** The metric to track usage for. */
+ fun metricId(metricId: Optional) = metricId(metricId.orElse(null))
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
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 6f058fdb..bbe95c43 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
@@ -81,7 +81,11 @@ constructor(
}
/** Used to update the status of a plan alert scoped to this subscription_id */
- fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId }
+ fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId }
+
+ /** Used to update the status of a plan alert scoped to this subscription_id */
+ fun subscriptionId(subscriptionId: Optional) =
+ subscriptionId(subscriptionId.orElse(null))
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 6121742f..2a91ab5b 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
@@ -81,7 +81,11 @@ constructor(
}
/** Used to update the status of a plan alert scoped to this subscription_id */
- fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId }
+ fun subscriptionId(subscriptionId: String?) = apply { this.subscriptionId = subscriptionId }
+
+ /** Used to update the status of a plan alert scoped to this subscription_id */
+ fun subscriptionId(subscriptionId: Optional) =
+ subscriptionId(subscriptionId.orElse(null))
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
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 93416dfc..19de6751 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
@@ -132,33 +132,69 @@ constructor(
additionalQueryParams = alertListParams.additionalQueryParams.toBuilder()
}
- fun createdAtGt(createdAtGt: OffsetDateTime) = apply { this.createdAtGt = createdAtGt }
+ fun createdAtGt(createdAtGt: OffsetDateTime?) = apply { this.createdAtGt = createdAtGt }
- fun createdAtGte(createdAtGte: OffsetDateTime) = apply { this.createdAtGte = createdAtGte }
+ fun createdAtGt(createdAtGt: Optional) =
+ createdAtGt(createdAtGt.orElse(null))
- fun createdAtLt(createdAtLt: OffsetDateTime) = apply { this.createdAtLt = createdAtLt }
+ fun createdAtGte(createdAtGte: OffsetDateTime?) = apply { this.createdAtGte = createdAtGte }
- fun createdAtLte(createdAtLte: OffsetDateTime) = apply { this.createdAtLte = createdAtLte }
+ fun createdAtGte(createdAtGte: Optional) =
+ createdAtGte(createdAtGte.orElse(null))
+
+ fun createdAtLt(createdAtLt: OffsetDateTime?) = apply { this.createdAtLt = createdAtLt }
+
+ fun createdAtLt(createdAtLt: Optional) =
+ createdAtLt(createdAtLt.orElse(null))
+
+ fun createdAtLte(createdAtLte: OffsetDateTime?) = apply { this.createdAtLte = createdAtLte }
+
+ fun createdAtLte(createdAtLte: Optional) =
+ createdAtLte(createdAtLte.orElse(null))
+
+ /**
+ * Cursor for pagination. This can be populated by the `next_cursor` value returned from the
+ * initial request.
+ */
+ fun cursor(cursor: String?) = apply { this.cursor = cursor }
/**
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: String) = apply { this.cursor = cursor }
+ fun cursor(cursor: Optional) = cursor(cursor.orElse(null))
/** Fetch alerts scoped to this customer_id */
- fun customerId(customerId: String) = apply { this.customerId = customerId }
+ fun customerId(customerId: String?) = apply { this.customerId = customerId }
+
+ /** Fetch alerts scoped to this customer_id */
+ fun customerId(customerId: Optional) = customerId(customerId.orElse(null))
/** Fetch alerts scoped to this external_customer_id */
- fun externalCustomerId(externalCustomerId: String) = apply {
+ fun externalCustomerId(externalCustomerId: String?) = apply {
this.externalCustomerId = externalCustomerId
}
+ /** Fetch alerts scoped to this external_customer_id */
+ fun externalCustomerId(externalCustomerId: Optional) =
+ externalCustomerId(externalCustomerId.orElse(null))
+
+ /** The number of items to fetch. Defaults to 20. */
+ fun limit(limit: Long?) = apply { this.limit = limit }
+
/** The number of items to fetch. Defaults to 20. */
- fun limit(limit: Long) = apply { this.limit = limit }
+ 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?)
+
+ /** 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: String) = apply { this.subscriptionId = subscriptionId }
+ fun subscriptionId(subscriptionId: Optional) =
+ subscriptionId(subscriptionId.orElse(null))
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 1f28e47d..742a810c 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
@@ -22,22 +22,23 @@ import java.util.Optional
class AmountDiscount
@JsonCreator
private constructor(
- @JsonProperty("discount_type")
+ @JsonProperty("amount_discount")
@ExcludeMissing
- private val discountType: JsonField = JsonMissing.of(),
+ private val amountDiscount: JsonField = JsonMissing.of(),
@JsonProperty("applies_to_price_ids")
@ExcludeMissing
private val appliesToPriceIds: JsonField> = JsonMissing.of(),
+ @JsonProperty("discount_type")
+ @ExcludeMissing
+ private val discountType: JsonField = JsonMissing.of(),
@JsonProperty("reason")
@ExcludeMissing
private val reason: JsonField = JsonMissing.of(),
- @JsonProperty("amount_discount")
- @ExcludeMissing
- private val amountDiscount: JsonField = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(),
) {
- fun discountType(): DiscountType = discountType.getRequired("discount_type")
+ /** Only available if discount_type is `amount`. */
+ fun amountDiscount(): String = amountDiscount.getRequired("amount_discount")
/**
* List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a
@@ -45,12 +46,12 @@ private constructor(
*/
fun appliesToPriceIds(): List = appliesToPriceIds.getRequired("applies_to_price_ids")
+ fun discountType(): DiscountType = discountType.getRequired("discount_type")
+
fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
/** Only available if discount_type is `amount`. */
- fun amountDiscount(): String = amountDiscount.getRequired("amount_discount")
-
- @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType
+ @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount
/**
* List of price_ids that this discount applies to. For plan/plan phase discounts, this can be a
@@ -60,10 +61,9 @@ private constructor(
@ExcludeMissing
fun _appliesToPriceIds() = appliesToPriceIds
- @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+ @JsonProperty("discount_type") @ExcludeMissing fun _discountType() = discountType
- /** Only available if discount_type is `amount`. */
- @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
@JsonAnyGetter
@ExcludeMissing
@@ -73,10 +73,10 @@ private constructor(
fun validate(): AmountDiscount = apply {
if (!validated) {
- discountType()
+ amountDiscount()
appliesToPriceIds()
+ discountType()
reason()
- amountDiscount()
validated = true
}
}
@@ -90,25 +90,27 @@ private constructor(
class Builder {
- private var discountType: JsonField = JsonMissing.of()
+ private var amountDiscount: JsonField = JsonMissing.of()
private var appliesToPriceIds: JsonField> = JsonMissing.of()
+ private var discountType: JsonField = JsonMissing.of()
private var reason: JsonField = JsonMissing.of()
- private var amountDiscount: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(amountDiscount: AmountDiscount) = apply {
- discountType = amountDiscount.discountType
+ this.amountDiscount = amountDiscount.amountDiscount
appliesToPriceIds = amountDiscount.appliesToPriceIds
+ discountType = amountDiscount.discountType
reason = amountDiscount.reason
- this.amountDiscount = amountDiscount.amountDiscount
additionalProperties = amountDiscount.additionalProperties.toMutableMap()
}
- fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType))
+ /** Only available if discount_type is `amount`. */
+ fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount))
- fun discountType(discountType: JsonField) = apply {
- this.discountType = discountType
+ /** Only available if discount_type is `amount`. */
+ fun amountDiscount(amountDiscount: JsonField) = apply {
+ this.amountDiscount = amountDiscount
}
/**
@@ -126,17 +128,15 @@ private constructor(
this.appliesToPriceIds = appliesToPriceIds
}
- fun reason(reason: String) = reason(JsonField.of(reason))
+ fun discountType(discountType: DiscountType) = discountType(JsonField.of(discountType))
- fun reason(reason: JsonField) = apply { this.reason = reason }
+ fun discountType(discountType: JsonField) = apply {
+ this.discountType = discountType
+ }
- /** Only available if discount_type is `amount`. */
- fun amountDiscount(amountDiscount: String) = amountDiscount(JsonField.of(amountDiscount))
+ fun reason(reason: String) = reason(JsonField.of(reason))
- /** Only available if discount_type is `amount`. */
- fun amountDiscount(amountDiscount: JsonField) = apply {
- this.amountDiscount = amountDiscount
- }
+ fun reason(reason: JsonField) = apply { this.reason = reason }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
@@ -159,10 +159,10 @@ private constructor(
fun build(): AmountDiscount =
AmountDiscount(
- discountType,
+ amountDiscount,
appliesToPriceIds.map { it.toImmutable() },
+ discountType,
reason,
- amountDiscount,
additionalProperties.toImmutable(),
)
}
@@ -223,15 +223,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is AmountDiscount && discountType == other.discountType && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is AmountDiscount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && discountType == other.discountType && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(discountType, appliesToPriceIds, reason, amountDiscount, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(amountDiscount, appliesToPriceIds, discountType, reason, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "AmountDiscount{discountType=$discountType, appliesToPriceIds=$appliesToPriceIds, reason=$reason, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}"
+ "AmountDiscount{amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, discountType=$discountType, reason=$reason, additionalProperties=$additionalProperties}"
}
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 f663634e..78faf058 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
@@ -26,37 +26,26 @@ import java.util.Optional
class BillableMetric
@JsonCreator
private constructor(
- @JsonProperty("metadata")
- @ExcludeMissing
- private val metadata: JsonField = JsonMissing.of(),
@JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(),
- @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(),
@JsonProperty("description")
@ExcludeMissing
private val description: JsonField = JsonMissing.of(),
+ @JsonProperty("item") @ExcludeMissing private val item: JsonField- = JsonMissing.of(),
+ @JsonProperty("metadata")
+ @ExcludeMissing
+ private val metadata: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing private val name: JsonField = JsonMissing.of(),
@JsonProperty("status")
@ExcludeMissing
private val status: JsonField = JsonMissing.of(),
- @JsonProperty("item") @ExcludeMissing private val item: JsonField
- = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(),
) {
- /**
- * User specified key-value pairs for the resource. If not present, this defaults to an empty
- * dictionary. Individual keys can be removed by setting the value to `null`, and the entire
- * metadata mapping can be cleared by setting `metadata` to `null`.
- */
- fun metadata(): Metadata = metadata.getRequired("metadata")
-
fun id(): String = id.getRequired("id")
- fun name(): String = name.getRequired("name")
-
fun description(): Optional =
Optional.ofNullable(description.getNullable("description"))
- fun status(): Status = status.getRequired("status")
-
/**
* The Item resource represents a sellable product or good. Items are associated with all line
* items, billable metrics, and prices and are used for defining external sync behavior for
@@ -69,15 +58,15 @@ private constructor(
* dictionary. Individual keys can be removed by setting the value to `null`, and the entire
* metadata mapping can be cleared by setting `metadata` to `null`.
*/
- @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata
+ fun metadata(): Metadata = metadata.getRequired("metadata")
- @JsonProperty("id") @ExcludeMissing fun _id() = id
+ fun name(): String = name.getRequired("name")
- @JsonProperty("name") @ExcludeMissing fun _name() = name
+ fun status(): Status = status.getRequired("status")
- @JsonProperty("description") @ExcludeMissing fun _description() = description
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
- @JsonProperty("status") @ExcludeMissing fun _status() = status
+ @JsonProperty("description") @ExcludeMissing fun _description() = description
/**
* The Item resource represents a sellable product or good. Items are associated with all line
@@ -86,6 +75,17 @@ private constructor(
*/
@JsonProperty("item") @ExcludeMissing fun _item() = item
+ /**
+ * User specified key-value pairs for the resource. If not present, this defaults to an empty
+ * dictionary. Individual keys can be removed by setting the value to `null`, and the entire
+ * metadata mapping can be cleared by setting `metadata` to `null`.
+ */
+ @JsonProperty("metadata") @ExcludeMissing fun _metadata() = metadata
+
+ @JsonProperty("name") @ExcludeMissing fun _name() = name
+
+ @JsonProperty("status") @ExcludeMissing fun _status() = status
+
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
@@ -94,12 +94,12 @@ private constructor(
fun validate(): BillableMetric = apply {
if (!validated) {
- metadata().validate()
id()
- name()
description()
- status()
item().validate()
+ metadata().validate()
+ name()
+ status()
validated = true
}
}
@@ -113,55 +113,33 @@ private constructor(
class Builder {
- private var metadata: JsonField = JsonMissing.of()
private var id: JsonField = JsonMissing.of()
- private var name: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
- private var status: JsonField = JsonMissing.of()
private var item: JsonField
- = JsonMissing.of()
+ private var metadata: JsonField = JsonMissing.of()
+ private var name: JsonField = JsonMissing.of()
+ private var status: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(billableMetric: BillableMetric) = apply {
- metadata = billableMetric.metadata
id = billableMetric.id
- name = billableMetric.name
description = billableMetric.description
- status = billableMetric.status
item = billableMetric.item
+ metadata = billableMetric.metadata
+ name = billableMetric.name
+ status = billableMetric.status
additionalProperties = billableMetric.additionalProperties.toMutableMap()
}
- /**
- * User specified key-value pairs for the resource. If not present, this defaults to an
- * empty dictionary. Individual keys can be removed by setting the value to `null`, and the
- * entire metadata mapping can be cleared by setting `metadata` to `null`.
- */
- fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata))
-
- /**
- * User specified key-value pairs for the resource. If not present, this defaults to an
- * empty dictionary. Individual keys can be removed by setting the value to `null`, and the
- * entire metadata mapping can be cleared by setting `metadata` to `null`.
- */
- fun metadata(metadata: JsonField) = apply { this.metadata = metadata }
-
fun id(id: String) = id(JsonField.of(id))
fun id(id: JsonField) = apply { this.id = id }
- fun name(name: String) = name(JsonField.of(name))
-
- fun name(name: JsonField) = apply { this.name = name }
-
fun description(description: String) = description(JsonField.of(description))
fun description(description: JsonField) = apply { this.description = description }
- fun status(status: Status) = status(JsonField.of(status))
-
- fun status(status: JsonField) = apply { this.status = status }
-
/**
* The Item resource represents a sellable product or good. Items are associated with all
* line items, billable metrics, and prices and are used for defining external sync behavior
@@ -176,6 +154,28 @@ private constructor(
*/
fun item(item: JsonField
- ) = apply { this.item = item }
+ /**
+ * User specified key-value pairs for the resource. If not present, this defaults to an
+ * empty dictionary. Individual keys can be removed by setting the value to `null`, and the
+ * entire metadata mapping can be cleared by setting `metadata` to `null`.
+ */
+ fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata))
+
+ /**
+ * User specified key-value pairs for the resource. If not present, this defaults to an
+ * empty dictionary. Individual keys can be removed by setting the value to `null`, and the
+ * entire metadata mapping can be cleared by setting `metadata` to `null`.
+ */
+ fun metadata(metadata: JsonField) = apply { this.metadata = metadata }
+
+ fun name(name: String) = name(JsonField.of(name))
+
+ fun name(name: JsonField) = apply { this.name = name }
+
+ fun status(status: Status) = status(JsonField.of(status))
+
+ fun status(status: JsonField) = apply { this.status = status }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -197,12 +197,12 @@ private constructor(
fun build(): BillableMetric =
BillableMetric(
- metadata,
id,
- name,
description,
- status,
item,
+ metadata,
+ name,
+ status,
additionalProperties.toImmutable(),
)
}
@@ -355,15 +355,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is BillableMetric && metadata == other.metadata && id == other.id && name == other.name && description == other.description && status == other.status && item == other.item && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is BillableMetric && id == other.id && description == other.description && item == other.item && metadata == other.metadata && name == other.name && status == other.status && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(metadata, id, name, description, status, item, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, description, item, metadata, name, status, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "BillableMetric{metadata=$metadata, id=$id, name=$name, description=$description, status=$status, item=$item, additionalProperties=$additionalProperties}"
+ "BillableMetric{id=$id, description=$description, item=$item, metadata=$metadata, name=$name, status=$status, additionalProperties=$additionalProperties}"
}
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 f46e0c52..0dc97ab6 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
@@ -71,38 +71,39 @@ class Coupon
@JsonCreator
private constructor(
@JsonProperty("id") @ExcludeMissing private val id: JsonField = JsonMissing.of(),
- @JsonProperty("redemption_code")
+ @JsonProperty("archived_at")
@ExcludeMissing
- private val redemptionCode: JsonField = JsonMissing.of(),
+ private val archivedAt: JsonField = JsonMissing.of(),
@JsonProperty("discount")
@ExcludeMissing
private val discount: JsonField = JsonMissing.of(),
- @JsonProperty("times_redeemed")
- @ExcludeMissing
- private val timesRedeemed: JsonField = JsonMissing.of(),
@JsonProperty("duration_in_months")
@ExcludeMissing
private val durationInMonths: JsonField = JsonMissing.of(),
@JsonProperty("max_redemptions")
@ExcludeMissing
private val maxRedemptions: JsonField = JsonMissing.of(),
- @JsonProperty("archived_at")
+ @JsonProperty("redemption_code")
@ExcludeMissing
- private val archivedAt: JsonField = JsonMissing.of(),
+ private val redemptionCode: JsonField = JsonMissing.of(),
+ @JsonProperty("times_redeemed")
+ @ExcludeMissing
+ private val timesRedeemed: JsonField = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(),
) {
/** Also referred to as coupon_id in this documentation. */
fun id(): String = id.getRequired("id")
- /** This string can be used to redeem this coupon for a given subscription. */
- fun redemptionCode(): String = redemptionCode.getRequired("redemption_code")
+ /**
+ * 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(): Optional =
+ Optional.ofNullable(archivedAt.getNullable("archived_at"))
fun discount(): Discount = discount.getRequired("discount")
- /** The number of times this coupon has been redeemed. */
- fun timesRedeemed(): Long = timesRedeemed.getRequired("times_redeemed")
-
/**
* This allows for a coupon's discount to apply for a limited time (determined in months); a
* `null` value here means "unlimited time".
@@ -117,24 +118,23 @@ private constructor(
fun maxRedemptions(): Optional =
Optional.ofNullable(maxRedemptions.getNullable("max_redemptions"))
- /**
- * 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(): Optional =
- Optional.ofNullable(archivedAt.getNullable("archived_at"))
+ /** This string can be used to redeem this coupon for a given subscription. */
+ fun redemptionCode(): String = redemptionCode.getRequired("redemption_code")
+
+ /** The number of times this coupon has been redeemed. */
+ fun timesRedeemed(): Long = timesRedeemed.getRequired("times_redeemed")
/** Also referred to as coupon_id in this documentation. */
@JsonProperty("id") @ExcludeMissing fun _id() = id
- /** This string can be used to redeem this coupon for a given subscription. */
- @JsonProperty("redemption_code") @ExcludeMissing fun _redemptionCode() = redemptionCode
+ /**
+ * 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.
+ */
+ @JsonProperty("archived_at") @ExcludeMissing fun _archivedAt() = archivedAt
@JsonProperty("discount") @ExcludeMissing fun _discount() = discount
- /** The number of times this coupon has been redeemed. */
- @JsonProperty("times_redeemed") @ExcludeMissing fun _timesRedeemed() = timesRedeemed
-
/**
* This allows for a coupon's discount to apply for a limited time (determined in months); a
* `null` value here means "unlimited time".
@@ -147,11 +147,11 @@ private constructor(
*/
@JsonProperty("max_redemptions") @ExcludeMissing fun _maxRedemptions() = maxRedemptions
- /**
- * 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.
- */
- @JsonProperty("archived_at") @ExcludeMissing fun _archivedAt() = archivedAt
+ /** This string can be used to redeem this coupon for a given subscription. */
+ @JsonProperty("redemption_code") @ExcludeMissing fun _redemptionCode() = redemptionCode
+
+ /** The number of times this coupon has been redeemed. */
+ @JsonProperty("times_redeemed") @ExcludeMissing fun _timesRedeemed() = timesRedeemed
@JsonAnyGetter
@ExcludeMissing
@@ -162,12 +162,12 @@ private constructor(
fun validate(): Coupon = apply {
if (!validated) {
id()
- redemptionCode()
+ archivedAt()
discount()
- timesRedeemed()
durationInMonths()
maxRedemptions()
- archivedAt()
+ redemptionCode()
+ timesRedeemed()
validated = true
}
}
@@ -182,23 +182,23 @@ private constructor(
class Builder {
private var id: JsonField = JsonMissing.of()
- private var redemptionCode: JsonField = JsonMissing.of()
+ private var archivedAt: JsonField = JsonMissing.of()
private var discount: JsonField = JsonMissing.of()
- private var timesRedeemed: JsonField = JsonMissing.of()
private var durationInMonths: JsonField = JsonMissing.of()
private var maxRedemptions: JsonField = JsonMissing.of()
- private var archivedAt: JsonField = JsonMissing.of()
+ private var redemptionCode: JsonField = JsonMissing.of()
+ private var timesRedeemed: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(coupon: Coupon) = apply {
id = coupon.id
- redemptionCode = coupon.redemptionCode
+ archivedAt = coupon.archivedAt
discount = coupon.discount
- timesRedeemed = coupon.timesRedeemed
durationInMonths = coupon.durationInMonths
maxRedemptions = coupon.maxRedemptions
- archivedAt = coupon.archivedAt
+ redemptionCode = coupon.redemptionCode
+ timesRedeemed = coupon.timesRedeemed
additionalProperties = coupon.additionalProperties.toMutableMap()
}
@@ -208,26 +208,24 @@ private constructor(
/** Also referred to as coupon_id in this documentation. */
fun id(id: JsonField) = apply { this.id = id }
- /** This string can be used to redeem this coupon for a given subscription. */
- fun redemptionCode(redemptionCode: String) = redemptionCode(JsonField.of(redemptionCode))
+ /**
+ * 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: OffsetDateTime) = archivedAt(JsonField.of(archivedAt))
- /** This string can be used to redeem this coupon for a given subscription. */
- fun redemptionCode(redemptionCode: JsonField) = apply {
- this.redemptionCode = redemptionCode
+ /**
+ * 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: JsonField) = apply {
+ this.archivedAt = archivedAt
}
fun discount(discount: Discount) = discount(JsonField.of(discount))
fun discount(discount: JsonField) = apply { this.discount = discount }
- /** The number of times this coupon has been redeemed. */
- fun timesRedeemed(timesRedeemed: Long) = timesRedeemed(JsonField.of(timesRedeemed))
-
- /** The number of times this coupon has been redeemed. */
- fun timesRedeemed(timesRedeemed: JsonField) = apply {
- this.timesRedeemed = timesRedeemed
- }
-
/**
* This allows for a coupon's discount to apply for a limited time (determined in months); a
* `null` value here means "unlimited time".
@@ -257,18 +255,20 @@ private constructor(
this.maxRedemptions = maxRedemptions
}
- /**
- * 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: OffsetDateTime) = archivedAt(JsonField.of(archivedAt))
+ /** This string can be used to redeem this coupon for a given subscription. */
+ fun redemptionCode(redemptionCode: String) = redemptionCode(JsonField.of(redemptionCode))
- /**
- * 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: JsonField) = apply {
- this.archivedAt = archivedAt
+ /** This string can be used to redeem this coupon for a given subscription. */
+ fun redemptionCode(redemptionCode: JsonField) = apply {
+ this.redemptionCode = redemptionCode
+ }
+
+ /** The number of times this coupon has been redeemed. */
+ fun timesRedeemed(timesRedeemed: Long) = timesRedeemed(JsonField.of(timesRedeemed))
+
+ /** The number of times this coupon has been redeemed. */
+ fun timesRedeemed(timesRedeemed: JsonField) = apply {
+ this.timesRedeemed = timesRedeemed
}
fun additionalProperties(additionalProperties: Map) = apply {
@@ -293,12 +293,12 @@ private constructor(
fun build(): Coupon =
Coupon(
id,
- redemptionCode,
+ archivedAt,
discount,
- timesRedeemed,
durationInMonths,
maxRedemptions,
- archivedAt,
+ redemptionCode,
+ timesRedeemed,
additionalProperties.toImmutable(),
)
}
@@ -438,15 +438,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is Coupon && id == other.id && redemptionCode == other.redemptionCode && discount == other.discount && timesRedeemed == other.timesRedeemed && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && archivedAt == other.archivedAt && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Coupon && id == other.id && archivedAt == other.archivedAt && discount == other.discount && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && redemptionCode == other.redemptionCode && timesRedeemed == other.timesRedeemed && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, redemptionCode, discount, timesRedeemed, durationInMonths, maxRedemptions, archivedAt, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, archivedAt, discount, durationInMonths, maxRedemptions, redemptionCode, timesRedeemed, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "Coupon{id=$id, redemptionCode=$redemptionCode, discount=$discount, timesRedeemed=$timesRedeemed, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, archivedAt=$archivedAt, additionalProperties=$additionalProperties}"
+ "Coupon{id=$id, archivedAt=$archivedAt, discount=$discount, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, redemptionCode=$redemptionCode, timesRedeemed=$timesRedeemed, additionalProperties=$additionalProperties}"
}
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 fc1e9782..e3b39047 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
@@ -146,18 +146,47 @@ constructor(
* This allows for a coupon's discount to apply for a limited time (determined in
* months); a `null` value here means "unlimited time".
*/
- fun durationInMonths(durationInMonths: Long) = apply {
+ fun durationInMonths(durationInMonths: Long?) = apply {
this.durationInMonths = durationInMonths
}
+ /**
+ * This allows for a coupon's discount to apply for a limited time (determined in
+ * months); a `null` value here means "unlimited time".
+ */
+ fun durationInMonths(durationInMonths: Long) =
+ durationInMonths(durationInMonths as Long?)
+
+ /**
+ * 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?)
+
/**
* The maximum number of redemptions allowed for this coupon before it is
* exhausted;`null` here means "unlimited".
*/
- fun maxRedemptions(maxRedemptions: Long) = apply {
+ fun maxRedemptions(maxRedemptions: Long?) = apply {
this.maxRedemptions = maxRedemptions
}
+ /**
+ * The maximum number of redemptions allowed for this coupon before it is
+ * exhausted;`null` here means "unlimited".
+ */
+ fun maxRedemptions(maxRedemptions: Long) = maxRedemptions(maxRedemptions as Long?)
+
+ /**
+ * 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?)
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -243,15 +272,43 @@ constructor(
* This allows for a coupon's discount to apply for a limited time (determined in months); a
* `null` value here means "unlimited time".
*/
- fun durationInMonths(durationInMonths: Long) = apply {
+ fun durationInMonths(durationInMonths: Long?) = apply {
body.durationInMonths(durationInMonths)
}
+ /**
+ * This allows for a coupon's discount to apply for a limited time (determined in months); a
+ * `null` value here means "unlimited time".
+ */
+ fun durationInMonths(durationInMonths: Long) = durationInMonths(durationInMonths as Long?)
+
+ /**
+ * 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?)
+
/**
* The maximum number of redemptions allowed for this coupon before it is exhausted;`null`
* here means "unlimited".
*/
- fun maxRedemptions(maxRedemptions: Long) = apply { body.maxRedemptions(maxRedemptions) }
+ fun maxRedemptions(maxRedemptions: Long?) = apply { body.maxRedemptions(maxRedemptions) }
+
+ /**
+ * The maximum number of redemptions allowed for this coupon before it is exhausted;`null`
+ * here means "unlimited".
+ */
+ fun maxRedemptions(maxRedemptions: Long) = maxRedemptions(maxRedemptions as Long?)
+
+ /**
+ * 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?)
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
@@ -656,16 +713,16 @@ constructor(
class NewCouponAmountDiscount
@JsonCreator
private constructor(
- @JsonProperty("discount_type") private val discountType: DiscountType,
@JsonProperty("amount_discount") private val amountDiscount: String,
+ @JsonProperty("discount_type") private val discountType: DiscountType,
@JsonAnySetter
private val additionalProperties: Map = immutableEmptyMap(),
) {
- @JsonProperty("discount_type") fun discountType(): DiscountType = discountType
-
@JsonProperty("amount_discount") fun amountDiscount(): String = amountDiscount
+ @JsonProperty("discount_type") fun discountType(): DiscountType = discountType
+
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
@@ -679,26 +736,26 @@ constructor(
class Builder {
- private var discountType: DiscountType? = null
private var amountDiscount: String? = null
+ private var discountType: DiscountType? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(newCouponAmountDiscount: NewCouponAmountDiscount) = apply {
- discountType = newCouponAmountDiscount.discountType
amountDiscount = newCouponAmountDiscount.amountDiscount
+ discountType = newCouponAmountDiscount.discountType
additionalProperties =
newCouponAmountDiscount.additionalProperties.toMutableMap()
}
- fun discountType(discountType: DiscountType) = apply {
- this.discountType = discountType
- }
-
fun amountDiscount(amountDiscount: String) = apply {
this.amountDiscount = amountDiscount
}
+ fun discountType(discountType: DiscountType) = apply {
+ this.discountType = discountType
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -723,10 +780,10 @@ constructor(
fun build(): NewCouponAmountDiscount =
NewCouponAmountDiscount(
- checkNotNull(discountType) { "`discountType` is required but was not set" },
checkNotNull(amountDiscount) {
"`amountDiscount` is required but was not set"
},
+ checkNotNull(discountType) { "`discountType` is required but was not set" },
additionalProperties.toImmutable(),
)
}
@@ -787,17 +844,17 @@ constructor(
return true
}
- return /* spotless:off */ other is NewCouponAmountDiscount && discountType == other.discountType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is NewCouponAmountDiscount && amountDiscount == other.amountDiscount && discountType == other.discountType && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(discountType, amountDiscount, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(amountDiscount, discountType, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "NewCouponAmountDiscount{discountType=$discountType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}"
+ "NewCouponAmountDiscount{amountDiscount=$amountDiscount, discountType=$discountType, additionalProperties=$additionalProperties}"
}
}
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 a0ac648a..14f5711e 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
@@ -81,18 +81,47 @@ constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: String) = apply { this.cursor = cursor }
+ fun cursor(cursor: String?) = apply { this.cursor = cursor }
+
+ /**
+ * 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))
/** The number of items to fetch. Defaults to 20. */
- fun limit(limit: Long) = apply { this.limit = limit }
+ fun limit(limit: Long?) = apply { this.limit = limit }
+
+ /** The number of items to fetch. Defaults to 20. */
+ 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?)
/** Filter to coupons matching this redemption code. */
- fun redemptionCode(redemptionCode: String) = apply { this.redemptionCode = redemptionCode }
+ fun redemptionCode(redemptionCode: String?) = apply { this.redemptionCode = redemptionCode }
+
+ /** Filter to coupons matching this redemption code. */
+ fun redemptionCode(redemptionCode: Optional) =
+ redemptionCode(redemptionCode.orElse(null))
+
+ /**
+ * Show archived coupons as well (by default, this endpoint only returns active coupons).
+ */
+ fun showArchived(showArchived: Boolean?) = apply { this.showArchived = showArchived }
+
+ /**
+ * Show archived coupons as well (by default, this endpoint only returns active coupons).
+ */
+ fun showArchived(showArchived: Boolean) = showArchived(showArchived as Boolean?)
/**
* Show archived coupons as well (by default, this endpoint only returns active coupons).
*/
- fun showArchived(showArchived: Boolean) = apply { this.showArchived = showArchived }
+ @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
+ fun showArchived(showArchived: Optional) =
+ showArchived(showArchived.orElse(null) as Boolean?)
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
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 b1dd0d33..c96c78be 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
@@ -81,10 +81,23 @@ constructor(
* Cursor for pagination. This can be populated by the `next_cursor` value returned from the
* initial request.
*/
- fun cursor(cursor: String) = apply { this.cursor = cursor }
+ fun cursor(cursor: String?) = apply { this.cursor = cursor }
+
+ /**
+ * 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))
+
+ /** The number of items to fetch. Defaults to 20. */
+ fun limit(limit: Long?) = apply { this.limit = limit }
+
+ /** The number of items to fetch. Defaults to 20. */
+ fun limit(limit: Long) = limit(limit as Long?)
/** The number of items to fetch. Defaults to 20. */
- fun limit(limit: Long) = apply { this.limit = limit }
+ @Suppress("USELESS_CAST") // See https://youtrack.jetbrains.com/issue/KT-74228
+ fun limit(limit: Optional) = limit(limit.orElse(null) as Long?)
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 1f9a836f..85aa4b0f 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
@@ -31,42 +31,42 @@ private constructor(
@JsonProperty("created_at")
@ExcludeMissing
private val createdAt: JsonField = JsonMissing.of(),
- @JsonProperty("voided_at")
- @ExcludeMissing
- private val voidedAt: JsonField = JsonMissing.of(),
@JsonProperty("credit_note_number")
@ExcludeMissing
private val creditNoteNumber: JsonField = JsonMissing.of(),
+ @JsonProperty("credit_note_pdf")
+ @ExcludeMissing
+ private val creditNotePdf: JsonField = JsonMissing.of(),
+ @JsonProperty("customer")
+ @ExcludeMissing
+ private val customer: JsonField = JsonMissing.of(),
@JsonProperty("invoice_id")
@ExcludeMissing
private val invoiceId: JsonField = JsonMissing.of(),
+ @JsonProperty("line_items")
+ @ExcludeMissing
+ private val lineItems: JsonField
> = JsonMissing.of(),
+ @JsonProperty("maximum_amount_adjustment")
+ @ExcludeMissing
+ private val maximumAmountAdjustment: JsonField = JsonMissing.of(),
@JsonProperty("memo") @ExcludeMissing private val memo: JsonField = JsonMissing.of(),
+ @JsonProperty("minimum_amount_refunded")
+ @ExcludeMissing
+ private val minimumAmountRefunded: JsonField = JsonMissing.of(),
@JsonProperty("reason")
@ExcludeMissing
private val reason: JsonField = JsonMissing.of(),
- @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(),
@JsonProperty("subtotal")
@ExcludeMissing
private val subtotal: JsonField = JsonMissing.of(),
@JsonProperty("total") @ExcludeMissing private val total: JsonField = JsonMissing.of(),
- @JsonProperty("customer")
- @ExcludeMissing
- private val customer: JsonField = JsonMissing.of(),
- @JsonProperty("credit_note_pdf")
- @ExcludeMissing
- private val creditNotePdf: JsonField = JsonMissing.of(),
- @JsonProperty("minimum_amount_refunded")
+ @JsonProperty("type") @ExcludeMissing private val type: JsonField = JsonMissing.of(),
+ @JsonProperty("voided_at")
@ExcludeMissing
- private val minimumAmountRefunded: JsonField = JsonMissing.of(),
+ private val voidedAt: JsonField = JsonMissing.of(),
@JsonProperty("discounts")
@ExcludeMissing
private val discounts: JsonField> = JsonMissing.of(),
- @JsonProperty("maximum_amount_adjustment")
- @ExcludeMissing
- private val maximumAmountAdjustment: JsonField = JsonMissing.of(),
- @JsonProperty("line_items")
- @ExcludeMissing
- private val lineItems: JsonField> = JsonMissing.of(),
@JsonAnySetter private val additionalProperties: Map = immutableEmptyMap(),
) {
@@ -76,22 +76,33 @@ private constructor(
/** The creation time of the resource in Orb. */
fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at")
- /** The time at which the credit note was voided in Orb, if applicable. */
- fun voidedAt(): Optional =
- Optional.ofNullable(voidedAt.getNullable("voided_at"))
-
/** The unique identifier for credit notes. */
fun creditNoteNumber(): String = creditNoteNumber.getRequired("credit_note_number")
+ /** A URL to a PDF of the credit note. */
+ fun creditNotePdf(): Optional =
+ Optional.ofNullable(creditNotePdf.getNullable("credit_note_pdf"))
+
+ fun customer(): Customer = customer.getRequired("customer")
+
/** The id of the invoice resource that this credit note is applied to. */
fun invoiceId(): String = invoiceId.getRequired("invoice_id")
+ /** All of the line items associated with this credit note. */
+ fun lineItems(): List = lineItems.getRequired("line_items")
+
+ /** The maximum amount applied on the original invoice */
+ fun maximumAmountAdjustment(): Optional =
+ Optional.ofNullable(maximumAmountAdjustment.getNullable("maximum_amount_adjustment"))
+
/** An optional memo supplied on the credit note. */
fun memo(): Optional = Optional.ofNullable(memo.getNullable("memo"))
- fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
+ /** Any credited amount from the applied minimum on the invoice. */
+ fun minimumAmountRefunded(): Optional =
+ Optional.ofNullable(minimumAmountRefunded.getNullable("minimum_amount_refunded"))
- fun type(): Type = type.getRequired("type")
+ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
/** The total prior to any creditable invoice-level discounts or minimums. */
fun subtotal(): String = subtotal.getRequired("subtotal")
@@ -99,48 +110,50 @@ private constructor(
/** The total including creditable invoice-level discounts or minimums, and tax. */
fun total(): String = total.getRequired("total")
- fun customer(): Customer = customer.getRequired("customer")
-
- /** A URL to a PDF of the credit note. */
- fun creditNotePdf(): Optional =
- Optional.ofNullable(creditNotePdf.getNullable("credit_note_pdf"))
+ fun type(): Type = type.getRequired("type")
- /** Any credited amount from the applied minimum on the invoice. */
- fun minimumAmountRefunded(): Optional =
- Optional.ofNullable(minimumAmountRefunded.getNullable("minimum_amount_refunded"))
+ /** The time at which the credit note was voided in Orb, if applicable. */
+ fun voidedAt(): Optional =
+ Optional.ofNullable(voidedAt.getNullable("voided_at"))
/** Any discounts applied on the original invoice. */
fun discounts(): Optional> =
Optional.ofNullable(discounts.getNullable("discounts"))
- /** The maximum amount applied on the original invoice */
- fun maximumAmountAdjustment(): Optional =
- Optional.ofNullable(maximumAmountAdjustment.getNullable("maximum_amount_adjustment"))
-
- /** All of the line items associated with this credit note. */
- fun lineItems(): List = lineItems.getRequired("line_items")
-
/** The Orb id of this credit note. */
@JsonProperty("id") @ExcludeMissing fun _id() = id
/** The creation time of the resource in Orb. */
@JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt
- /** The time at which the credit note was voided in Orb, if applicable. */
- @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt
-
/** The unique identifier for credit notes. */
@JsonProperty("credit_note_number") @ExcludeMissing fun _creditNoteNumber() = creditNoteNumber
+ /** A URL to a PDF of the credit note. */
+ @JsonProperty("credit_note_pdf") @ExcludeMissing fun _creditNotePdf() = creditNotePdf
+
+ @JsonProperty("customer") @ExcludeMissing fun _customer() = customer
+
/** The id of the invoice resource that this credit note is applied to. */
@JsonProperty("invoice_id") @ExcludeMissing fun _invoiceId() = invoiceId
+ /** All of the line items associated with this credit note. */
+ @JsonProperty("line_items") @ExcludeMissing fun _lineItems() = lineItems
+
+ /** The maximum amount applied on the original invoice */
+ @JsonProperty("maximum_amount_adjustment")
+ @ExcludeMissing
+ fun _maximumAmountAdjustment() = maximumAmountAdjustment
+
/** An optional memo supplied on the credit note. */
@JsonProperty("memo") @ExcludeMissing fun _memo() = memo
- @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+ /** Any credited amount from the applied minimum on the invoice. */
+ @JsonProperty("minimum_amount_refunded")
+ @ExcludeMissing
+ fun _minimumAmountRefunded() = minimumAmountRefunded
- @JsonProperty("type") @ExcludeMissing fun _type() = type
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
/** The total prior to any creditable invoice-level discounts or minimums. */
@JsonProperty("subtotal") @ExcludeMissing fun _subtotal() = subtotal
@@ -148,27 +161,14 @@ private constructor(
/** The total including creditable invoice-level discounts or minimums, and tax. */
@JsonProperty("total") @ExcludeMissing fun _total() = total
- @JsonProperty("customer") @ExcludeMissing fun _customer() = customer
-
- /** A URL to a PDF of the credit note. */
- @JsonProperty("credit_note_pdf") @ExcludeMissing fun _creditNotePdf() = creditNotePdf
+ @JsonProperty("type") @ExcludeMissing fun _type() = type
- /** Any credited amount from the applied minimum on the invoice. */
- @JsonProperty("minimum_amount_refunded")
- @ExcludeMissing
- fun _minimumAmountRefunded() = minimumAmountRefunded
+ /** The time at which the credit note was voided in Orb, if applicable. */
+ @JsonProperty("voided_at") @ExcludeMissing fun _voidedAt() = voidedAt
/** Any discounts applied on the original invoice. */
@JsonProperty("discounts") @ExcludeMissing fun _discounts() = discounts
- /** The maximum amount applied on the original invoice */
- @JsonProperty("maximum_amount_adjustment")
- @ExcludeMissing
- fun _maximumAmountAdjustment() = maximumAmountAdjustment
-
- /** All of the line items associated with this credit note. */
- @JsonProperty("line_items") @ExcludeMissing fun _lineItems() = lineItems
-
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
@@ -179,20 +179,20 @@ private constructor(
if (!validated) {
id()
createdAt()
- voidedAt()
creditNoteNumber()
+ creditNotePdf()
+ customer().validate()
invoiceId()
+ lineItems().forEach { it.validate() }
+ maximumAmountAdjustment().map { it.validate() }
memo()
+ minimumAmountRefunded()
reason()
- type()
subtotal()
total()
- customer().validate()
- creditNotePdf()
- minimumAmountRefunded()
+ type()
+ voidedAt()
discounts().map { it.forEach { it.validate() } }
- maximumAmountAdjustment().map { it.validate() }
- lineItems().forEach { it.validate() }
validated = true
}
}
@@ -208,40 +208,40 @@ private constructor(
private var id: JsonField = JsonMissing.of()
private var createdAt: JsonField = JsonMissing.of()
- private var voidedAt: JsonField = JsonMissing.of()
private var creditNoteNumber: JsonField = JsonMissing.of()
+ private var creditNotePdf: JsonField = JsonMissing.of()
+ private var customer: JsonField = JsonMissing.of()
private var invoiceId: JsonField = JsonMissing.of()
+ private var lineItems: JsonField> = JsonMissing.of()
+ private var maximumAmountAdjustment: JsonField = JsonMissing.of()
private var memo: JsonField = JsonMissing.of()
+ private var minimumAmountRefunded: JsonField = JsonMissing.of()
private var reason: JsonField = JsonMissing.of()
- private var type: JsonField = JsonMissing.of()
private var subtotal: JsonField = JsonMissing.of()
private var total: JsonField = JsonMissing.of()
- private var customer: JsonField = JsonMissing.of()
- private var creditNotePdf: JsonField = JsonMissing.of()
- private var minimumAmountRefunded: JsonField = JsonMissing.of()
+ private var type: JsonField = JsonMissing.of()
+ private var voidedAt: JsonField = JsonMissing.of()
private var discounts: JsonField> = JsonMissing.of()
- private var maximumAmountAdjustment: JsonField = JsonMissing.of()
- private var lineItems: JsonField> = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(creditNote: CreditNote) = apply {
id = creditNote.id
createdAt = creditNote.createdAt
- voidedAt = creditNote.voidedAt
creditNoteNumber = creditNote.creditNoteNumber
+ creditNotePdf = creditNote.creditNotePdf
+ customer = creditNote.customer
invoiceId = creditNote.invoiceId
+ lineItems = creditNote.lineItems
+ maximumAmountAdjustment = creditNote.maximumAmountAdjustment
memo = creditNote.memo
+ minimumAmountRefunded = creditNote.minimumAmountRefunded
reason = creditNote.reason
- type = creditNote.type
subtotal = creditNote.subtotal
total = creditNote.total
- customer = creditNote.customer
- creditNotePdf = creditNote.creditNotePdf
- minimumAmountRefunded = creditNote.minimumAmountRefunded
+ type = creditNote.type
+ voidedAt = creditNote.voidedAt
discounts = creditNote.discounts
- maximumAmountAdjustment = creditNote.maximumAmountAdjustment
- lineItems = creditNote.lineItems
additionalProperties = creditNote.additionalProperties.toMutableMap()
}
@@ -257,12 +257,6 @@ private constructor(
/** The creation time of the resource in Orb. */
fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
- /** The time at which the credit note was voided in Orb, if applicable. */
- fun voidedAt(voidedAt: OffsetDateTime) = voidedAt(JsonField.of(voidedAt))
-
- /** The time at which the credit note was voided in Orb, if applicable. */
- fun voidedAt(voidedAt: JsonField